blob: f37604cc5443dce9fc39d9bb3d495afa88607555 [file] [log] [blame]
Shih-wei Liaof8fd82b2010-02-10 11:10:31 -08001// RUN: %clang_cc1 -verify -fsyntax-only %s
2
3int x(*g); // expected-error {{use of undeclared identifier 'g'}}
4
5struct Type {
6 int Type;
7};
8
9
10// PR4451 - We should recover well from the typo of '::' as ':' in a2.
11namespace y {
12 struct a { };
13 typedef int b;
14}
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};
39
40enum { fooenum = 1 };
41
42struct a {
43 int Type : fooenum;
44};
45
46void test(struct Type *P) {
47 int Type;
48 Type = 1 ? P->Type : Type;
49
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;
54}
55
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};