blob: ae004ce81c1d5347075d7b405ca247ec00626129 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -verify -fsyntax-only %s
Chris Lattner8129edb2009-04-12 22:23:27 +00002
3int x(*g); // expected-error {{use of undeclared identifier 'g'}}
Chris Lattner46646492009-12-07 01:36:53 +00004
Chris Lattnera69d0ed2009-12-10 02:02:58 +00005struct Type {
6 int Type;
7};
Chris Lattnera1efc8c2009-12-10 01:59:24 +00008
Chris Lattner46646492009-12-07 01:36:53 +00009
10// PR4451 - We should recover well from the typo of '::' as ':' in a2.
11namespace y {
Chris Lattner932dff72009-12-10 02:08:07 +000012 struct a { };
13 typedef int b;
Chris Lattner46646492009-12-07 01:36:53 +000014}
15
16y::a a1;
17y:a a2; // expected-error {{unexpected ':' in nested name specifier}}
18y::a a3 = a2;
19
20// Some valid colons:
21void foo() {
22y: // label
23 y::a s;
24
25 int a = 4;
26 a = a ? a : a+1;
27}
28
29struct b : y::a {};
30
31template <typename T>
32class someclass {
33
34 int bar() {
35 T *P;
36 return 1 ? P->x : P->y;
37 }
38};
Chris Lattnera1efc8c2009-12-10 01:59:24 +000039
40enum { fooenum = 1 };
41
42struct a {
43 int Type : fooenum;
44};
45
Chris Lattnera69d0ed2009-12-10 02:02:58 +000046void test(struct Type *P) {
47 int Type;
48 Type = 1 ? P->Type : Type;
Chris Lattner932dff72009-12-10 02:08:07 +000049
50 Type = (y:b) 4; // expected-error {{unexpected ':' in nested name specifier}}
51 Type = 1 ? (
52 (y:b) // expected-error {{unexpected ':' in nested name specifier}}
53 4) : 5;
Daniel Dunbara5728872009-12-15 20:14:24 +000054}
Chris Lattnerae50d502010-02-02 00:43:15 +000055
56struct test4 {
57 int x // expected-error {{expected ';' at end of declaration list}}
58 int y;
59 int z // expected-error {{expected ';' at end of declaration list}}
60};
John McCall2e0a7152010-03-01 18:20:46 +000061
62// PR5825
63struct test5 {};
64::new(static_cast<void*>(0)) test5; // expected-error {{expected unqualified-id}}
Chris Lattner5c5db552010-04-05 18:18:31 +000065
66
67// PR6782
68template<class T>
69class Class1;
70
71class Class2 {
72} // no ;
73
74typedef Class1<Class2> Type1; // expected-error {{cannot combine with previous 'class' declaration specifier}}