summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/nested-name-spec.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/nested-name-spec.cpp')
-rw-r--r--test/SemaCXX/nested-name-spec.cpp37
1 files changed, 31 insertions, 6 deletions
diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp
index bdeb00d..0fbdedc 100644
--- a/test/SemaCXX/nested-name-spec.cpp
+++ b/test/SemaCXX/nested-name-spec.cpp
@@ -13,7 +13,7 @@ namespace A {
}
A:: ; // expected-error {{expected unqualified-id}}
-::A::ax::undef ex3; // expected-error {{'ax' is not a class, namespace, or scoped enumeration}}
+::A::ax::undef ex3; // expected-error {{'ax' is not a class, namespace, or enumeration}}
A::undef1::undef2 ex4; // expected-error {{no member named 'undef1'}}
int A::C::Ag1() { return 0; }
@@ -88,9 +88,9 @@ void f3() {
// declared here", "template 'X' declared here", etc) to help explain what it
// is if it's 'not a class, namespace, or scoped enumeration'.
int N; // expected-note {{'N' declared here}}
- N::x = 0; // expected-error {{'N' is not a class, namespace, or scoped enumeration}}
+ N::x = 0; // expected-error {{'N' is not a class, namespace, or enumeration}}
{ int A; A::ax = 0; }
- { typedef int A; A::ax = 0; } // expected-error{{'A' (aka 'int') is not a class, namespace, or scoped enumeration}}
+ { typedef int A; A::ax = 0; } // expected-error{{'A' (aka 'int') is not a class, namespace, or enumeration}}
{ typedef A::C A; A::ax = 0; } // expected-error {{no member named 'ax'}}
{ typedef A::C A; A::cx = 0; }
}
@@ -115,8 +115,8 @@ namespace E {
X = 0
};
- void f() {
- return E::X; // expected-error{{'E::Nested::E' is not a class, namespace, or scoped enumeration}}
+ int f() {
+ return E::X; // expected-warning{{use of enumeration in a nested name specifier is a C++11 extension}}
}
}
}
@@ -310,7 +310,7 @@ namespace N {
}
namespace TypedefNamespace { typedef int F; };
-TypedefNamespace::F::NonexistentName BadNNSWithCXXScopeSpec; // expected-error {{'F' (aka 'int') is not a class, namespace, or scoped enumeration}}
+TypedefNamespace::F::NonexistentName BadNNSWithCXXScopeSpec; // expected-error {{'F' (aka 'int') is not a class, namespace, or enumeration}}
namespace PR18587 {
@@ -410,3 +410,28 @@ struct S7c {
};
}
+
+namespace PR16951 {
+ namespace ns {
+ enum an_enumeration {
+ ENUMERATOR // expected-note{{'ENUMERATOR' declared here}}
+ };
+ }
+
+ int x1 = ns::an_enumeration::ENUMERATOR; // expected-warning{{use of enumeration in a nested name specifier is a C++11 extension}}
+
+ int x2 = ns::an_enumeration::ENUMERATOR::vvv; // expected-warning{{use of enumeration in a nested name specifier is a C++11 extension}} \
+ // expected-error{{'ENUMERATOR' is not a class, namespace, or enumeration}} \
+
+ int x3 = ns::an_enumeration::X; // expected-warning{{use of enumeration in a nested name specifier is a C++11 extension}} \
+ // expected-error{{no member named 'X'}}
+
+ enum enumerator_2 {
+ ENUMERATOR_2
+ };
+
+ int x4 = enumerator_2::ENUMERATOR_2; // expected-warning{{use of enumeration in a nested name specifier is a C++11 extension}}
+ int x5 = enumerator_2::X2; // expected-warning{{use of enumeration in a nested name specifier is a C++11 extension}} \
+ // expected-error{{no member named 'X2' in 'PR16951::enumerator_2'}}
+
+}
OpenPOWER on IntegriCloud