diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-03-28 16:01:27 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-03-28 16:01:27 +0000 |
commit | 6960587df0bd1b421c11715807a4d2302a3aae3c (patch) | |
tree | 816ec998283c43e315732268a37177abc5f5c841 /test/CXX | |
parent | 1e1e9722cb4ea6027e2c4885c7a8f26d3726ca7d (diff) |
Unify and fix our checking of C++ [dcl.meaning]p1's requirements
concerning qualified declarator-ids. We now diagnose extraneous
qualification at namespace scope (which we had previously missed) and
diagnose these qualification errors for all kinds of declarations; it
was rather uneven before. Fixes <rdar://problem/11135644>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153577 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX')
-rw-r--r-- | test/CXX/dcl.decl/dcl.meaning/p1.cpp | 15 | ||||
-rw-r--r-- | test/CXX/temp/p3.cpp | 4 |
2 files changed, 16 insertions, 3 deletions
diff --git a/test/CXX/dcl.decl/dcl.meaning/p1.cpp b/test/CXX/dcl.decl/dcl.meaning/p1.cpp index 9aa3a20bcd..3672ea0ea0 100644 --- a/test/CXX/dcl.decl/dcl.meaning/p1.cpp +++ b/test/CXX/dcl.decl/dcl.meaning/p1.cpp @@ -20,3 +20,18 @@ namespace PR8019 { }; } + +namespace NS { + void foo(); + extern int bar; + struct X; + template<typename T> struct Y; + template<typename T> void wibble(T); +} +namespace NS { + void NS::foo() {} // expected-warning{{extra qualification on member 'foo'}} + int NS::bar; // expected-warning{{extra qualification on member 'bar'}} + struct NS::X { }; // expected-warning{{extra qualification on member 'X'}} + template<typename T> struct NS::Y; // expected-warning{{extra qualification on member 'Y'}} + template<typename T> void NS::wibble(T) { } // expected-warning{{extra qualification on member 'wibble'}} +} diff --git a/test/CXX/temp/p3.cpp b/test/CXX/temp/p3.cpp index 16ebb381fd..c146bc4faa 100644 --- a/test/CXX/temp/p3.cpp +++ b/test/CXX/temp/p3.cpp @@ -6,11 +6,9 @@ template<typename T> struct S { template<typename T> int S<T>::a, S<T>::b; // expected-error {{can only declare a single entity}} -// FIXME: the last two diagnostics here are terrible. template<typename T> struct A { static A a; } A<T>::a; // expected-error {{expected ';' after struct}} \ expected-error {{use of undeclared identifier 'T'}} \ - expected-error {{cannot name the global scope}} \ - expected-error {{no member named 'a' in the global namespace}} + expected-warning{{extra qualification}} template<typename T> struct B { } f(); // expected-error {{expected ';' after struct}} \ expected-error {{requires a type specifier}} |