Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -pedantic -fblocks %s |
Eli Friedman | 0976278 | 2008-08-20 22:07:34 +0000 | [diff] [blame] | 2 | |
Chris Lattner | 18914bc | 2008-12-12 06:19:11 +0000 | [diff] [blame] | 3 | // PR2241 |
Daniel Dunbar | dbb4f21 | 2009-04-15 21:35:27 +0000 | [diff] [blame] | 4 | float test2241[2] = { |
Chris Lattner | 18914bc | 2008-12-12 06:19:11 +0000 | [diff] [blame] | 5 | 1e, // expected-error {{exponent}} |
| 6 | 1ee0 // expected-error {{exponent}} |
| 7 | }; |
| 8 | |
| 9 | |
Eli Friedman | 0976278 | 2008-08-20 22:07:34 +0000 | [diff] [blame] | 10 | // Testcase derived from PR2692 |
Mike Stump | d1969d8 | 2009-07-22 00:43:08 +0000 | [diff] [blame] | 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}} |
Eli Friedman | 0976278 | 2008-08-20 22:07:34 +0000 | [diff] [blame] | 15 | } |
| 16 | |
Chris Lattner | 90b93d6 | 2008-12-08 21:59:01 +0000 | [diff] [blame] | 17 | |
| 18 | // PR3172 |
| 19 | } // expected-error {{expected external declaration}} |
| 20 | |
| 21 | |
Chris Lattner | 18914bc | 2008-12-12 06:19:11 +0000 | [diff] [blame] | 22 | // rdar://6094870 |
Mike Stump | d1969d8 | 2009-07-22 00:43:08 +0000 | [diff] [blame] | 23 | void test(int a) { |
Chris Lattner | 18914bc | 2008-12-12 06:19:11 +0000 | [diff] [blame] | 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 | if (x.i == 0)) // expected-error {{expected expression}} |
| 42 | test(0); |
| 43 | else |
| 44 | ; |
| 45 | } |
| 46 | |
Chris Lattner | 0ba0dd6 | 2008-12-12 06:21:18 +0000 | [diff] [blame] | 47 | |
| 48 | |
| 49 | char (((( /* expected-note {{to match this '('}} */ |
| 50 | *X x ] )))); /* expected-error {{expected ')'}} */ |
| 51 | |
| 52 | ; // expected-warning {{ISO C does not allow an extra ';' outside of a function}} |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | struct S { void *X, *Y; }; |
| 58 | |
| 59 | struct S A = { |
| 60 | &BADIDENT, 0 /* expected-error {{use of undeclared identifier}} */ |
| 61 | }; |
Chris Lattner | fdb548e | 2008-12-12 19:20:14 +0000 | [diff] [blame] | 62 | |
| 63 | // rdar://6248081 |
Mike Stump | d1969d8 | 2009-07-22 00:43:08 +0000 | [diff] [blame] | 64 | void test6248081() { |
Chris Lattner | fdb548e | 2008-12-12 19:20:14 +0000 | [diff] [blame] | 65 | [10] // expected-error {{expected expression}} |
| 66 | } |
| 67 | |
Douglas Gregor | 4ec339f | 2009-01-19 19:26:10 +0000 | [diff] [blame] | 68 | struct forward; // expected-note{{forward declaration of 'struct forward'}} |
Eli Friedman | 5f76494 | 2008-12-17 22:22:03 +0000 | [diff] [blame] | 69 | void x(struct forward* x) {switch(x->a) {}} // expected-error {{incomplete definition of type}} |
Eli Friedman | 2342ef7 | 2008-12-17 22:19:57 +0000 | [diff] [blame] | 70 | |
Douglas Gregor | 4b2d3f7 | 2009-02-26 21:00:50 +0000 | [diff] [blame] | 71 | // PR3410 |
| 72 | void foo() { |
| 73 | int X; |
| 74 | X = 4 // expected-error{{expected ';' after expression}} |
| 75 | } |