diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/SemaCXX/nested-name-spec.cpp | 2 | ||||
-rw-r--r-- | clang/test/SemaCXX/qual-id-test.cpp | 41 | ||||
-rw-r--r-- | clang/test/SemaTemplate/member-function-template.cpp | 1 |
3 files changed, 37 insertions, 7 deletions
diff --git a/clang/test/SemaCXX/nested-name-spec.cpp b/clang/test/SemaCXX/nested-name-spec.cpp index 97f31033e8a..ffb20d20823 100644 --- a/clang/test/SemaCXX/nested-name-spec.cpp +++ b/clang/test/SemaCXX/nested-name-spec.cpp @@ -13,7 +13,7 @@ namespace A { } A:: ; // expected-error {{expected unqualified-id}} -::A::ax::undef ex3; // expected-error {{expected a class or namespace}} expected-error {{unknown type name 'undef'}} +::A::ax::undef ex3; // expected-error {{no member named}} expected-error {{unknown type name 'undef'}} A::undef1::undef2 ex4; // expected-error {{no member named 'undef1'}} expected-error {{unknown type name 'undef2'}} int A::C::Ag1() { return 0; } 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; diff --git a/clang/test/SemaTemplate/member-function-template.cpp b/clang/test/SemaTemplate/member-function-template.cpp index 8eb40c83c34..83bf16c6900 100644 --- a/clang/test/SemaTemplate/member-function-template.cpp +++ b/clang/test/SemaTemplate/member-function-template.cpp @@ -48,3 +48,4 @@ void test_X_f0_explicit(X x, int i, long l) { // PR4608 class A { template <class x> x a(x z) { return z+y; } int y; }; + |