Chris Lattner | 8129edb | 2009-04-12 22:23:27 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -verify -fsyntax-only %s |
| 2 | |
| 3 | int x(*g); // expected-error {{use of undeclared identifier 'g'}} |
Chris Lattner | 4664649 | 2009-12-07 01:36:53 +0000 | [diff] [blame] | 4 | |
Chris Lattner | a69d0ed | 2009-12-10 02:02:58 +0000 | [diff] [blame^] | 5 | struct Type { |
| 6 | int Type; |
| 7 | }; |
Chris Lattner | a1efc8c | 2009-12-10 01:59:24 +0000 | [diff] [blame] | 8 | |
Chris Lattner | 4664649 | 2009-12-07 01:36:53 +0000 | [diff] [blame] | 9 | |
| 10 | // PR4451 - We should recover well from the typo of '::' as ':' in a2. |
| 11 | namespace y { |
| 12 | struct a { }; |
| 13 | } |
| 14 | |
| 15 | y::a a1; |
| 16 | y:a a2; // expected-error {{unexpected ':' in nested name specifier}} |
| 17 | y::a a3 = a2; |
| 18 | |
| 19 | // Some valid colons: |
| 20 | void foo() { |
| 21 | y: // label |
| 22 | y::a s; |
| 23 | |
| 24 | int a = 4; |
| 25 | a = a ? a : a+1; |
| 26 | } |
| 27 | |
| 28 | struct b : y::a {}; |
| 29 | |
| 30 | template <typename T> |
| 31 | class someclass { |
| 32 | |
| 33 | int bar() { |
| 34 | T *P; |
| 35 | return 1 ? P->x : P->y; |
| 36 | } |
| 37 | }; |
Chris Lattner | a1efc8c | 2009-12-10 01:59:24 +0000 | [diff] [blame] | 38 | |
| 39 | enum { fooenum = 1 }; |
| 40 | |
| 41 | struct a { |
| 42 | int Type : fooenum; |
| 43 | }; |
| 44 | |
Chris Lattner | a69d0ed | 2009-12-10 02:02:58 +0000 | [diff] [blame^] | 45 | void test(struct Type *P) { |
| 46 | int Type; |
| 47 | Type = 1 ? P->Type : Type; |
| 48 | } |