Debian Codegraph @

clang/test/SemaCXX/cxx-delayed-typo-correction-crashes.cpp

raw
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2
3 namespace GH138850 {
4 void test() {
5 int tmp = add(int, 0, 0); // expected-error {{expected '(' for function-style cast or type construction}} \
6 expected-note {{previous definition is here}}
7 uint tmp = add(uint, 1, 1); // expected-error {{use of undeclared identifier 'uint'; did you mean 'int'?}} \
8 expected-error {{redefinition of 'tmp'}} \
9 expected-error {{use of undeclared identifier 'uint'}}
10 call(void, f, (int)tmp); // expected-error {{expected '(' for function-style cast or type construction}} \
11 expected-error {{use of undeclared identifier 'f'}}
12 }
13 }
14
15 namespace GH107840 {
16 struct tm {}; // expected-note {{'tm' declared here}}
17
18 auto getCache = [&] { // expected-error {{non-local lambda expression cannot have a capture-default}}
19 ::foo([=] { // expected-error {{no member named 'foo' in the global namespace}}
20 tms time; // expected-error {{unknown type name 'tms'; did you mean 'tm'?}}
21 (void)time;
22 });
23 };
24 }
25
26 namespace GH59391 {
27 template <typename b> class c {
28 c(b);
29 b e;
30 void f() {
31 for (auto core : a::c(cores)) { // expected-error {{use of undeclared identifier 'cores'}} \
32 expected-error {{use of undeclared identifier 'a'}}
33 }
34 }
35 };
36 }
37
38 namespace GH45915 {
39 short g_volatile_ushort; // expected-note {{'g_volatile_ushort' declared here}}
40 namespace a {
41 int b = l_volatile_uwchar.a ::c ::~d<>; // expected-error {{use of undeclared identifier 'l_volatile_uwchar'}} \
42 expected-error {{no member named 'd' in namespace 'GH45915::a'}}
43 }
44 }
45
46 namespace GH45891 {
47 int a = b.c < enum , > :: template ~d < > [ e; // expected-error {{use of undeclared identifier 'b'}} \
48 expected-error {{expected identifier or '{'}} \
49 expected-error {{expected ';' after top level declarator}}
50 }
51
52 namespace GH32903 {
53 void
54 B(
55 char cat_dog_3, char cat_dog_2, char cat_dog_1, char cat_dog_0, char pigeon_dog_3, char pigeon_dog_2,
56 char pigeon_dog_1, char pigeon_dog_0, short &elefant15_lion, short &elefant14_lion, short &elefant13_lion, // expected-note 3 {{declared here}}
57 short &elefant12_lion, short &elefant11_lion, short &elefant10_lion, short &elefant9_lion, short &elefant8_lion, // expected-note 5 {{declared here}}
58 short &elefant7_lion, short &elefant6_lion, short &elefant5_lion, short &elefant4_lion, short &elefant3_lion, // expected-note 2 {{declared here}}
59 short &elefant2_lion, short &elefant1_lion, short &elefant0_lion, char& no_animal)
60 {
61
62 A( // FIXME: it's surprising that we don't issue a "use of undeclared identifier" diagnostic for the call itself.
63 elefant_15_lion, elefant_14_lion, elefant_13_lion, elefant_12_lion, elefant_11_lion, elefant_10_lion, elefant_9_lion, // expected-error 7 {{use of undeclared identifier}}
64 elefant_8_lion, elefant_7_lion, elefant_6_lion, elefant_5_lion, elefant_4_lion, elefant_3_lion, elefant_2_lion, // expected-error 7 {{use of undeclared identifier}}
65 elefant_1_lion, elefant_0_lion, no_animal, other_mammal); // expected-error 3 {{use of undeclared identifier}}
66 }
67 }