summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-03-26 04:58:10 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-03-26 04:58:10 +0000
commit38f0df352fadc546c5666079fb22de5ec1819d92 (patch)
tree1713e0b3b1c2a38a49ec508e8f5d92283ed739b3 /test/SemaCXX
parent4ca93d9978aac02b01814b4f749d6903a1f87ee5 (diff)
Handle instantiations of redeclarations of forward-declared enumerations within
templated functions. Build a redeclaration chain, and only instantiate the definition of the enum when visiting the defining declaration. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153427 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX')
-rw-r--r--test/SemaCXX/enum-scoped.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/SemaCXX/enum-scoped.cpp b/test/SemaCXX/enum-scoped.cpp
index c842dcde84..ebe9245358 100644
--- a/test/SemaCXX/enum-scoped.cpp
+++ b/test/SemaCXX/enum-scoped.cpp
@@ -221,3 +221,27 @@ namespace test9 {
// never instantiate the definitions of S<short>::ET nor S<short>::Eint.
S<short> s; // expected-note {{in instantiation of}}
}
+
+namespace test10 {
+ template<typename T> int f() {
+ enum E : int;
+ enum E : T; // expected-note {{here}}
+ E x;
+ enum E : int { e }; // expected-error {{different underlying}}
+ x = e;
+ return x;
+ }
+ int k = f<int>();
+ int l = f<short>(); // expected-note {{here}}
+
+ template<typename T> int g() {
+ enum class E : int;
+ enum class E : T; // expected-note {{here}}
+ E x;
+ enum class E : int { e }; // expected-error {{different underlying}}
+ x = E::e;
+ return (int)x;
+ }
+ int m = g<int>();
+ int n = g<short>(); // expected-note {{here}}
+}