Argiris Kirtzidis | 054a263 | 2008-11-08 17:17:31 +0000 | [diff] [blame^] | 1 | // RUN: clang -fsyntax-only -verify %s |
| 2 | namespace A { |
| 3 | struct C { |
| 4 | static int cx; |
| 5 | }; |
| 6 | int ax; |
| 7 | void Af(); |
| 8 | } |
| 9 | |
| 10 | A:: ; // expected-error {{expected unqualified-id}} |
| 11 | ::A::ax::undef ex3; // expected-error {{expected a class or namespace}} expected-error {{expected '=', ',', ';', 'asm', or '__attribute__' after declarator}} |
| 12 | A::undef1::undef2 ex4; // expected-error {{no member named 'undef1'}} expected-error {{expected '=', ',', ';', 'asm', or '__attribute__' after declarator}} |
| 13 | |
| 14 | class C2 { |
| 15 | void m(); |
| 16 | int x; |
| 17 | }; |
| 18 | |
| 19 | void C2::m() { |
| 20 | x = 0; |
| 21 | } |
| 22 | |
| 23 | namespace B { |
| 24 | void ::A::Af() {} // expected-error {{definition or redeclaration for 'Af' not in a namespace enclosing 'A'}} |
| 25 | } |
| 26 | |
| 27 | void f1() { |
| 28 | void A::Af(); // expected-error {{definition or redeclaration for 'Af' not allowed inside a function}} |
| 29 | } |
| 30 | |
| 31 | void f2() { |
| 32 | A:: ; // expected-error {{expected unqualified-id}} |
| 33 | A::C::undef = 0; // expected-error {{no member named 'undef'}} |
| 34 | ::A::C::cx = 0; |
| 35 | int x = ::A::ax = A::C::cx; |
| 36 | x = sizeof(A::C); |
| 37 | x = sizeof(::A::C::cx); |
| 38 | } |
| 39 | |
| 40 | A::C c1; |
| 41 | struct A::C c2; |
| 42 | struct S : public A::C {}; |
| 43 | struct A::undef; // expected-error {{'undef' does not name a tag member in the specified scope}} |
| 44 | |
| 45 | void f3() { |
| 46 | N::x = 0; // expected-error {{use of undeclared identifier 'N'}} |
| 47 | int N; |
| 48 | N::x = 0; // expected-error {{expected a class or namespace}} |
| 49 | { int A; A::ax = 0; } |
| 50 | { enum A {}; A::ax = 0; } |
| 51 | { enum A { A }; A::ax = 0; } |
| 52 | { typedef int A; A::ax = 0; } |
| 53 | { typedef int A(); A::ax = 0; } |
| 54 | { typedef A::C A; A::ax = 0; } // expected-error {{no member named 'ax'}} |
| 55 | { typedef A::C A; A::cx = 0; } |
| 56 | } |