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