summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/template-instantiation.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-11-04 03:18:57 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-11-04 03:18:57 +0000
commit9a94d9b876acd67f4476cecc5f26fd6c9f39b4b8 (patch)
tree6ff72409949e5f5ddefe1b2ce5f93c2d689cdc1b /clang/test/CodeGenCXX/template-instantiation.cpp
parenta95069c52fb4a4e7492252b8cbb8765e621d485c (diff)
downloadbcm5719-llvm-9a94d9b876acd67f4476cecc5f26fd6c9f39b4b8.tar.gz
bcm5719-llvm-9a94d9b876acd67f4476cecc5f26fd6c9f39b4b8.zip
Don't instantiate members not belonging in the semantic context of the template.
e.g. for: template <int i> class A { class B *g; }; 'class B' has the template as lexical context but semantically it is introduced in namespace scope. Fixes rdar://8611125 & http://llvm.org/PR8505 llvm-svn: 118235
Diffstat (limited to 'clang/test/CodeGenCXX/template-instantiation.cpp')
-rw-r--r--clang/test/CodeGenCXX/template-instantiation.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/template-instantiation.cpp b/clang/test/CodeGenCXX/template-instantiation.cpp
index a8729035e28..0df2e23c70c 100644
--- a/clang/test/CodeGenCXX/template-instantiation.cpp
+++ b/clang/test/CodeGenCXX/template-instantiation.cpp
@@ -109,3 +109,16 @@ namespace test4 {
A<int>::foo();
}
}
+
+namespace PR8505 {
+// Hits an assertion due to bogus instantiation of class B.
+template <int i> class A {
+ class B* g;
+};
+class B {
+ void f () {}
+};
+// Should not instantiate class B since it is introduced in namespace scope.
+// CHECK-NOT: _ZN6PR85051AILi0EE1B1fEv
+template class A<0>;
+}
OpenPOWER on IntegriCloud