diff options
Diffstat (limited to 'clang/test/SemaCXX/nested-name-spec.cpp')
-rw-r--r-- | clang/test/SemaCXX/nested-name-spec.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/clang/test/SemaCXX/nested-name-spec.cpp b/clang/test/SemaCXX/nested-name-spec.cpp index 15d63e10a91..0fbdedc70a6 100644 --- a/clang/test/SemaCXX/nested-name-spec.cpp +++ b/clang/test/SemaCXX/nested-name-spec.cpp @@ -115,8 +115,8 @@ namespace E { X = 0 }; - void f() { - return E::X; // expected-error{{'E::Nested::E' is not a class, namespace, or enumeration}} + int f() { + return E::X; // expected-warning{{use of enumeration in a nested name specifier is a C++11 extension}} } } } @@ -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'}} + +} |