[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Parser / recovery.c
blob6fdbedffd236a365d554ccb5589de08455a29eac
1 // RUN: %clang_cc1 -fsyntax-only -verify -pedantic -fblocks %s
3 // PR2241
4 float test2241[2] = {
5 1e, // expected-error {{exponent}}
6 1ee0 // expected-error {{exponent}}
7 };
10 // Testcase derived from PR2692
11 static void f (char * (*g) (char **, int), char **p, ...) {
12 char *s;
13 va_list v; // expected-error {{identifier}}
14 s = g (p, __builtin_va_arg(v, int)); // expected-error {{identifier}}
18 // PR3172
19 } // expected-error {{extraneous closing brace ('}')}}
22 void test(int a) {
23 struct { int i; } x;
25 if (x.hello) // expected-error {{no member named 'hello'}}
26 test(0);
27 else
30 if (x.hello == 0) // expected-error {{no member named 'hello'}}
31 test(0);
32 else
35 if ((x.hello == 0)) // expected-error {{no member named 'hello'}}
36 test(0);
37 else
40 // PR12595
41 if (x.i == 0)) // expected-error {{extraneous ')' after condition, expected a statement}}
42 test(0);
43 else
49 char (((( /* expected-note {{to match this '('}} */
50 *X x ] )))); /* expected-error {{expected ')'}} */
52 ; // expected-warning {{extra ';' outside of a function}}
57 struct S { void *X, *Y; };
59 struct S A = {
60 &BADIDENT, 0 /* expected-error {{use of undeclared identifier}} */
63 void test6248081(void) {
64 [10] // expected-error {{expected expression}}
67 struct forward; // expected-note{{forward declaration of 'struct forward'}}
68 void x(struct forward* x) {switch(x->a) {}} // expected-error {{incomplete definition of type}}
70 // PR3410
71 void foo(void) {
72 int X;
73 X = 4 // expected-error{{expected ';' after expression}}
76 void test9045701(int x) {
77 #define VALUE 0
78 x = VALUE // expected-error{{expected ';' after expression}}
81 typedef int intptr_t; // expected-note {{'intptr_t' declared here}}
82 void bar(intptr y); // expected-error {{unknown type name 'intptr'; did you mean 'intptr_t'?}}
84 void test1(void) {
85 int x = 2: // expected-error {{expected ';' at end of declaration}}
86 int y = x;
87 int z = y;
90 void test2(int x) {
91 #define VALUE2 VALUE+VALUE
92 #define VALUE3 VALUE+0
93 #define VALUE4(x) x+0
94 x = VALUE2 // expected-error{{expected ';' after expression}}
95 x = VALUE3 // expected-error{{expected ';' after expression}}
96 x = VALUE4(0) // expected-error{{expected ';' after expression}}