summaryrefslogtreecommitdiff
path: root/clang/test/SemaTemplate/instantiate-local-class.cpp
diff options
context:
space:
mode:
authorZancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au>2012-09-24 09:58:17 +1000
committerZancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au>2012-09-24 09:58:17 +1000
commit222e2a7620e6520ffaf4fc4e69d79c18da31542e (patch)
tree7bfbc05bfa3b41c8f9d2e56d53a0bc3e310df239 /clang/test/SemaTemplate/instantiate-local-class.cpp
parent3d206f03985b50beacae843d880bccdc91a9f424 (diff)
Add the clang library to the repo (with some of my changes, too).
Diffstat (limited to 'clang/test/SemaTemplate/instantiate-local-class.cpp')
-rw-r--r--clang/test/SemaTemplate/instantiate-local-class.cpp67
1 files changed, 67 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/instantiate-local-class.cpp b/clang/test/SemaTemplate/instantiate-local-class.cpp
new file mode 100644
index 0000000..20b62c1
--- /dev/null
+++ b/clang/test/SemaTemplate/instantiate-local-class.cpp
@@ -0,0 +1,67 @@
+// RUN: %clang_cc1 -verify %s
+template<typename T>
+void f0() {
+ struct X;
+ typedef struct Y {
+ T (X::* f1())(int) { return 0; }
+ } Y2;
+
+ Y2 y = Y();
+}
+
+template void f0<int>();
+
+// PR5764
+namespace PR5764 {
+ struct X {
+ template <typename T>
+ void Bar() {
+ typedef T ValueType;
+ struct Y {
+ Y() { V = ValueType(); }
+
+ ValueType V;
+ };
+
+ Y y;
+ }
+ };
+
+ void test(X x) {
+ x.Bar<int>();
+ }
+}
+
+// Instantiation of local classes with virtual functions.
+namespace local_class_with_virtual_functions {
+ template <typename T> struct X { };
+ template <typename T> struct Y { };
+
+ template <typename T>
+ void f() {
+ struct Z : public X<Y<T>*> {
+ virtual void g(Y<T>* y) { }
+ void g2(int x) {(void)x;}
+ };
+ Z z;
+ (void)z;
+ }
+
+ struct S { };
+ void test() { f<S>(); }
+}
+
+namespace PR8801 {
+ template<typename T>
+ void foo() {
+ class X;
+ typedef int (X::*pmf_type)();
+ class X : public T { };
+
+ pmf_type pmf = &T::foo;
+ }
+
+ struct Y { int foo(); };
+
+ template void foo<Y>();
+}