aboutsummaryrefslogtreecommitdiff
path: root/test/SemaTemplate/instantiate-member-class.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-03-26 21:56:38 +0000
committerJohn McCall <rjmccall@apple.com>2010-03-26 21:56:38 +0000
commit2243288c4826905b5a0837f6f21d9d821688652e (patch)
tree4b2e38e11def7a51eb0d89810004348cf4453753 /test/SemaTemplate/instantiate-member-class.cpp
parent0fd8ff73630adab9a33123f23ef62fcf5c3cf326 (diff)
Properly account for redeclarations when explicitly instantiating class templates.
What happens here is that we actually turn the first declaration into a definition, regardless of whether it was actually originally a definition, and furthermore we do this all after we've instantiated all the declarations. This exposes a bug in my DefinitionData patch where it was only setting the DefinitionData for previous declarations, not future declarations. Fortunately, there's an iterator for that. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99657 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/instantiate-member-class.cpp')
-rw-r--r--test/SemaTemplate/instantiate-member-class.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/SemaTemplate/instantiate-member-class.cpp b/test/SemaTemplate/instantiate-member-class.cpp
index 5d69b50a76..44f396e47a 100644
--- a/test/SemaTemplate/instantiate-member-class.cpp
+++ b/test/SemaTemplate/instantiate-member-class.cpp
@@ -50,3 +50,33 @@ namespace test1 {
Registry<int>::node node(0);
}
}
+
+// Redeclarations during explicit instantiations.
+namespace test2 {
+ template <typename T> class A {
+ class Foo;
+ class Foo {
+ int foo();
+ };
+ };
+ template class A<int>;
+
+ template <typename T> class B {
+ class Foo;
+ class Foo {
+ typedef int X;
+ };
+ typename Foo::X x;
+ class Foo;
+ };
+ template class B<int>;
+
+ template <typename T> class C {
+ class Foo;
+ class Foo;
+ };
+ template <typename T> class C<T>::Foo {
+ int x;
+ };
+ template class C<int>;
+}