diff options
Diffstat (limited to 'clang/test/SemaCXX/qual-id-test.cpp')
-rw-r--r-- | clang/test/SemaCXX/qual-id-test.cpp | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/clang/test/SemaCXX/qual-id-test.cpp b/clang/test/SemaCXX/qual-id-test.cpp index ad013990cac..10f1a47a9d4 100644 --- a/clang/test/SemaCXX/qual-id-test.cpp +++ b/clang/test/SemaCXX/qual-id-test.cpp @@ -3,7 +3,7 @@ namespace A { namespace B { - struct base + struct base // expected-note{{object type}} { void x() {} void y() {} @@ -82,13 +82,31 @@ namespace C i.foo(); // expected-error{{member reference base type 'int' is not a structure or union}} } + void fun4a() { + A::sub *a; + + typedef A::member base; // expected-note{{current scope}} + a->base::x(); // expected-error{{ambiguous}} + } + + void fun4b() { + A::sub *a; + + typedef A::B::base base; + a->base::x(); + } + template<typename T> - void fun4() + void fun5() { T a; a.x(); a->foo(); +#if 0 + // FIXME: We need the notion of identifiers as dependent + // nested-name-specifiers without a prefix for this code to work. + // Things that work for the wrong reason a.A::sub::x(); a.A::B::base::x(); @@ -98,9 +116,20 @@ namespace C a.bad::x(); // Things that fail, but shouldn't - a.sub::x(); // expected-error{{use of undeclared identifier 'sub'}} - a.base::x(); // expected-error{{use of undeclared identifier 'base'}} - a.B::base::x(); // expected-error{{use of undeclared identifier 'B'}} - a->member::foo(); // expected-error{{use of undeclared identifier 'member'}} + a.sub::x(); // xpected-error{{use of undeclared identifier 'sub'}} + a.base::x(); // xpected-error{{use of undeclared identifier 'base'}} + a.B::base::x(); // xpected-error{{use of undeclared identifier 'B'}} + a->member::foo(); // xpected-error{{use of undeclared identifier 'member'}} +#endif } } + +// PR4703 +struct a { + int a; + static int sa; +}; + +a a; + +int a::sa = a.a; |