[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaCXX / typo-correction-cxx11.cpp
blob8c588203cc1283b73059f02d5d4459a48b30554e
1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
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:
19 namespace PR23140 {
20 auto lneed = gned.*[] {}; // expected-error-re {{use of undeclared identifier 'gned'{{$}}}}
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'?}}
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);
36 namespace NewTypoExprFromResolvingTypoAmbiguity {
37 struct A {
38 void Swap(A *other);
41 struct pair {
42 int first;
43 A *second;
46 struct map {
47 public:
48 void swap(map &x);
49 pair find(int x);
52 void run(A *annotations) {
53 map new_annotations;
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'?}}