| Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -fsyntax-only %s | 
| Chris Lattner | 8129edb | 2009-04-12 22:23:27 +0000 | [diff] [blame] | 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 { | 
| Chris Lattner | 932dff7 | 2009-12-10 02:08:07 +0000 | [diff] [blame] | 12 |   struct a { }; | 
 | 13 |   typedef int b; | 
| Chris Lattner | 4664649 | 2009-12-07 01:36:53 +0000 | [diff] [blame] | 14 | } | 
 | 15 |  | 
 | 16 | y::a a1; | 
 | 17 | y:a a2;  // expected-error {{unexpected ':' in nested name specifier}} | 
 | 18 | y::a a3 = a2; | 
 | 19 |  | 
 | 20 | // Some valid colons: | 
 | 21 | void foo() { | 
 | 22 | y:  // label | 
 | 23 |   y::a s; | 
 | 24 |    | 
 | 25 |   int a = 4; | 
 | 26 |   a = a ? a : a+1; | 
 | 27 | } | 
 | 28 |  | 
 | 29 | struct b : y::a {}; | 
 | 30 |  | 
 | 31 | template <typename T> | 
 | 32 | class someclass { | 
 | 33 |    | 
 | 34 |   int bar() { | 
 | 35 |     T *P; | 
 | 36 |     return 1 ? P->x : P->y; | 
 | 37 |   } | 
 | 38 | }; | 
| Chris Lattner | a1efc8c | 2009-12-10 01:59:24 +0000 | [diff] [blame] | 39 |  | 
| Chris Lattner | e656325 | 2010-06-13 05:34:18 +0000 | [diff] [blame] | 40 | class asm_class_test { | 
 | 41 |   void foo() __asm__("baz"); | 
 | 42 | }; | 
 | 43 |  | 
| Chris Lattner | a1efc8c | 2009-12-10 01:59:24 +0000 | [diff] [blame] | 44 | enum { fooenum = 1 }; | 
 | 45 |  | 
 | 46 | struct a { | 
 | 47 |   int Type : fooenum; | 
 | 48 | }; | 
 | 49 |  | 
| Chris Lattner | a69d0ed | 2009-12-10 02:02:58 +0000 | [diff] [blame] | 50 | void test(struct Type *P) { | 
 | 51 |   int Type; | 
 | 52 |   Type = 1 ? P->Type : Type; | 
| Chris Lattner | 932dff7 | 2009-12-10 02:08:07 +0000 | [diff] [blame] | 53 |    | 
 | 54 |   Type = (y:b) 4;   // expected-error {{unexpected ':' in nested name specifier}} | 
 | 55 |   Type = 1 ? ( | 
 | 56 |               (y:b)  // expected-error {{unexpected ':' in nested name specifier}} | 
 | 57 |               4) : 5; | 
| Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 58 | } | 
| Chris Lattner | ae50d50 | 2010-02-02 00:43:15 +0000 | [diff] [blame] | 59 |  | 
 | 60 | struct test4 { | 
 | 61 |   int x  // expected-error {{expected ';' at end of declaration list}} | 
 | 62 |   int y; | 
 | 63 |   int z  // expected-error {{expected ';' at end of declaration list}} | 
 | 64 | }; | 
| John McCall | 2e0a715 | 2010-03-01 18:20:46 +0000 | [diff] [blame] | 65 |  | 
 | 66 | // PR5825 | 
 | 67 | struct test5 {}; | 
 | 68 | ::new(static_cast<void*>(0)) test5; // expected-error {{expected unqualified-id}} | 
| Chris Lattner | 5c5db55 | 2010-04-05 18:18:31 +0000 | [diff] [blame] | 69 |  | 
 | 70 |  | 
 | 71 | // PR6782 | 
 | 72 | template<class T> | 
 | 73 | class Class1; | 
 | 74 |  | 
 | 75 | class Class2 { | 
 | 76 | }  // no ; | 
 | 77 |  | 
 | 78 | typedef Class1<Class2> Type1; // expected-error {{cannot combine with previous 'class' declaration specifier}} | 
| Fariborz Jahanian | d657742 | 2010-08-16 17:58:53 +0000 | [diff] [blame] | 79 |  | 
 | 80 | // rdar : // 8307865 | 
 | 81 | struct CodeCompleteConsumer { | 
 | 82 | }; | 
 | 83 |  | 
 | 84 | void CodeCompleteConsumer::() { // expected-error {{xpected unqualified-id}} | 
 | 85 | }  |