summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/nested-name-spec.cpp
diff options
context:
space:
mode:
authorSerge Pavlov <sepavloff@gmail.com>2015-01-18 20:04:35 +0000
committerSerge Pavlov <sepavloff@gmail.com>2015-01-18 20:04:35 +0000
commit25a8afa9579e79eedac113e15e1afaa6acc1e2a0 (patch)
tree4d904b9badc9fedb05bd65a0e3b902c530e9d60c /clang/test/SemaCXX/nested-name-spec.cpp
parent4843f193ade5020d8722ce85826e183b0a676203 (diff)
downloadbcm5719-llvm-25a8afa9579e79eedac113e15e1afaa6acc1e2a0.tar.gz
bcm5719-llvm-25a8afa9579e79eedac113e15e1afaa6acc1e2a0.zip
Handle unscoped enumeration in nested name specifier.
If an unscoped enum is used as a nested name specifier and the language dialect is not C++ 11, issue an extension warning. This fixes PR16951. Differential Revision: http://reviews.llvm.org/D6389 llvm-svn: 226413
Diffstat (limited to 'clang/test/SemaCXX/nested-name-spec.cpp')
-rw-r--r--clang/test/SemaCXX/nested-name-spec.cpp29
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'}}
+
+}
OpenPOWER on IntegriCloud