1 | // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s |
2 | |
3 | namespace PR23186 { |
4 | decltype(ned); // expected-error-re {{use of undeclared identifier 'ned'{{$}}}} |
5 | // The code below was triggering an UNREACHABLE in ASTContext::getTypeInfoImpl |
6 | // once the above code failed to recover properly after making the bogus |
7 | // correction of 'ned' to 'new'. |
8 | template <typename> |
9 | struct S { |
10 | enum { V }; |
11 | void f() { |
12 | switch (0) |
13 | case V: |
14 | ; |
15 | } |
16 | }; |
17 | } |
18 | |
19 | namespace PR23140 { |
20 | auto lneed = gned.*[] {}; // expected-error-re {{use of undeclared identifier 'gned'{{$}}}} |
21 | |
22 | void test(int aaa, int bbb, int thisvar) { // expected-note {{'thisvar' declared here}} |
23 | int thatval = aaa * (bbb + thatvar); // expected-error {{use of undeclared identifier 'thatvar'; did you mean 'thisvar'?}} |
24 | } |
25 | } |
26 | |
27 | namespace PR18854 { |
28 | void f() { |
29 | for (auto&& x : e) { // expected-error-re {{use of undeclared identifier 'e'{{$}}}} |
30 | auto Functor = [x]() {}; |
31 | long Alignment = __alignof__(Functor); |
32 | } |
33 | } |
34 | } |
35 | |
36 | namespace NewTypoExprFromResolvingTypoAmbiguity { |
37 | struct A { |
38 | void Swap(A *other); |
39 | }; |
40 | |
41 | struct pair { |
42 | int first; |
43 | A *second; |
44 | }; |
45 | |
46 | struct map { |
47 | public: |
48 | void swap(map &x); |
49 | pair find(int x); |
50 | }; |
51 | |
52 | void run(A *annotations) { |
53 | map new_annotations; |
54 | |
55 | auto &annotation = *annotations; |
56 | auto new_it = new_annotations.find(5); |
57 | auto &new_anotation = new_it.second; // expected-note {{'new_anotation' declared here}} |
58 | new_annotation->Swap(&annotation); // expected-error {{use of undeclared identifier 'new_annotation'; did you mean 'new_anotation'?}} |
59 | } |
60 | } |
61 | |