1 // RUN: %clang_cc1 -fsyntax-only -verify -pedantic -fblocks %s
2
3 // PR2241
4 float test2241[2] = {
5 1e, // expected-error {{exponent}}
6 1ee0 // expected-error {{exponent}}
7 };
8
9
10 // Testcase derived from PR2692
f(char * (* g)(char **,int),char ** p,...)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}}
15 }
16
17
18 // PR3172
19 } // expected-error {{extraneous closing brace ('}')}}
20
21
22 // rdar://6094870
23 void test(int a) {
24 struct { int i; } x;
25
26 if (x.hello) // expected-error {{no member named 'hello'}}
27 test(0);
28 else
29 ;
30
31 if (x.hello == 0) // expected-error {{no member named 'hello'}}
32 test(0);
33 else
34 ;
35
36 if ((x.hello == 0)) // expected-error {{no member named 'hello'}}
37 test(0);
38 else
39 ;
40
41 // PR12595
42 if (x.i == 0)) // expected-error {{extraneous ')' after condition, expected a statement}}
43 test(0);
44 else
45 ;
46 }
47
48
49
50 char (((( /* expected-note {{to match this '('}} */
51 *X x ] )))); /* expected-error {{expected ')'}} */
52
53 ; // expected-warning {{extra ';' outside of a function}}
54
55
56
57
58 struct S { void *X, *Y; };
59
60 struct S A = {
61 &BADIDENT, 0 /* expected-error {{use of undeclared identifier}} */
62 };
63
64 // rdar://6248081
65 void test6248081() {
66 [10] // expected-error {{expected expression}}
67 }
68
69 struct forward; // expected-note{{forward declaration of 'struct forward'}}
70 void x(struct forward* x) {switch(x->a) {}} // expected-error {{incomplete definition of type}}
71
72 // PR3410
73 void foo() {
74 int X;
75 X = 4 // expected-error{{expected ';' after expression}}
76 }
77
78 // rdar://9045701
79 void test9045701(int x) {
80 #define VALUE 0
81 x = VALUE // expected-error{{expected ';' after expression}}
82 }
83
84 // rdar://7980651
85 typedef int intptr_t; // expected-note {{'intptr_t' declared here}}
86 void bar(intptr y); // expected-error {{unknown type name 'intptr'; did you mean 'intptr_t'?}}
87
88 void test1(void) {
89 int x = 2: // expected-error {{expected ';' at end of declaration}}
90 int y = x;
91 int z = y;
92 }
93
94 void test2(int x) {
95 #define VALUE2 VALUE+VALUE
96 #define VALUE3 VALUE+0
97 #define VALUE4(x) x+0
98 x = VALUE2 // expected-error{{expected ';' after expression}}
99 x = VALUE3 // expected-error{{expected ';' after expression}}
100 x = VALUE4(0) // expected-error{{expected ';' after expression}}
101 }
102