1// RUN: %clang_cc1 -verify -fsyntax-only -triple i386-linux -pedantic %s 2 3const char const *x10; // expected-warning {{duplicate 'const' declaration specifier}} 4 5int x(*g); // expected-error {{use of undeclared identifier 'g'}} 6 7struct Type { 8 int Type; 9}; 10 11// rdar://8365458 12// rdar://9132143 13typedef char bool; // expected-error {{redeclaration of C++ built-in type 'bool'}} 14 15// PR4451 - We should recover well from the typo of '::' as ':' in a2. 16namespace y { 17 struct a { }; 18 typedef int b; 19} 20 21y::a a1; 22y:a a2; // expected-error {{unexpected ':' in nested name specifier}} 23y::a a3 = a2; 24 25// Some valid colons: 26void foo() { 27y: // label 28 y::a s; 29 30 int a = 4; 31 a = a ? a : a+1; 32} 33 34struct b : y::a {}; 35 36template <typename T> 37class someclass { 38 39 int bar() { 40 T *P; 41 return 1 ? P->x : P->y; 42 } 43}; 44 45class asm_class_test { 46 void foo() __asm__("baz"); 47}; 48 49enum { fooenum = 1, }; // expected-warning {{commas at the end of enumerator lists are a C++11 extension}} 50 51struct a { 52 int Type : fooenum; 53}; 54 55void test(struct Type *P) { 56 int Type; 57 Type = 1 ? P->Type : Type; 58 59 Type = (y:b) 4; // expected-error {{unexpected ':' in nested name specifier}} 60 Type = 1 ? ( 61 (y:b) // expected-error {{unexpected ':' in nested name specifier}} 62 4) : 5; 63} 64 65struct test4 { 66 int x // expected-error {{expected ';' at end of declaration list}} 67 int y; 68 int z // expected-error {{expected ';' at end of declaration list}} 69}; 70 71// Make sure we know these are legitimate commas and not typos for ';'. 72namespace Commas { 73 struct S { 74 static int a; 75 int c, 76 operator()(); 77 }; 78 79 int global1, 80 __attribute__(()) global2, 81 (global5), 82 *global6, 83 &global7 = global1, 84 &&global8 = static_cast<int&&>(global1), // expected-warning 2{{rvalue reference}} 85 S::a, 86 global9, 87 global10 = 0, 88 global11 == 0, // expected-error {{did you mean '='}} 89 global12 __attribute__(()), 90 global13(0), 91 global14[2], 92 global15; 93 94 void g() { 95 static int a, 96 b __asm__("ebx"), // expected-error {{expected ';' at end of declaration}} 97 Statics:return; 98 } 99} 100 101// PR5825 102struct test5 {}; 103::new(static_cast<void*>(0)) test5; // expected-error {{expected unqualified-id}} 104 105 106// PR6782 107template<class T> 108class Class1; 109 110class Class2 { 111} // no ; 112 113typedef Class1<Class2> Type1; // expected-error {{cannot combine with previous 'class' declaration specifier}} 114 115// rdar : // 8307865 116struct CodeCompleteConsumer { 117}; 118 119void CodeCompleteConsumer::() { // expected-error {{xpected unqualified-id}} 120} 121 122; 123 124// PR4111 125void f(sqrgl); // expected-error {{unknown type name 'sqrgl'}} 126 127// PR8380 128extern "" // expected-error {{unknown linkage language}} 129test6a { ;// expected-error {{C++ requires a type specifier for all declarations}} \ 130 // expected-error {{expected ';' after top level declarator}} 131 132 int test6b; 133