Clang Project

clang_source_code/test/SemaCXX/typo-correction-crash.cpp
1// RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify %s
2auto check1() {
3  return 1;
4  return s; // expected-error {{use of undeclared identifier 's'}}
5}
6
7int test = 11; // expected-note {{'test' declared here}}
8auto check2() {
9  return "s";
10  return tes; // expected-error {{use of undeclared identifier 'tes'; did you mean 'test'?}}
11}
12
13namespace BarNamespace {
14namespace NestedNamespace { // expected-note {{'BarNamespace::NestedNamespace' declared here}}
15typedef int type;
16}
17}
18struct FooRecord { };
19FooRecord::NestedNamespace::type x; // expected-error {{no member named 'NestedNamespace' in 'FooRecord'; did you mean 'BarNamespace::NestedNamespace'?}}
20
21void cast_expr(int g) { +int(n)(g); } // expected-error {{undeclared identifier 'n'}}
22
23void bind() { for (const auto& [test,_] : _test_) { }; } // expected-error {{undeclared identifier '_test_'}}
24