blob: d57ba8a68288bbe529c2346c55f2e28784f177bd [file] [log] [blame]
Douglas Gregor79c22782010-01-16 20:21:20 +00001// RUN: %clang_cc1 -verify %s
2template<typename T>
3void f0() {
4 struct X;
5 typedef struct Y {
6 T (X::* f1())(int) { return 0; }
7 } Y2;
8
9 Y2 y = Y();
10}
11
12template void f0<int>();
Douglas Gregor26997fd2010-01-16 20:52:59 +000013
14// PR5764
15namespace PR5764 {
John McCall7002f4c2010-04-09 19:03:51 +000016 struct X {
Douglas Gregor26997fd2010-01-16 20:52:59 +000017 template <typename T>
18 void Bar() {
Douglas Gregor60406be2010-01-16 22:29:39 +000019 typedef T ValueType;
John McCall7002f4c2010-04-09 19:03:51 +000020 struct Y {
Douglas Gregor60406be2010-01-16 22:29:39 +000021 Y() { V = ValueType(); }
22
23 ValueType V;
Douglas Gregor26997fd2010-01-16 20:52:59 +000024 };
25
26 Y y;
27 }
28 };
29
30 void test(X x) {
31 x.Bar<int>();
32 }
33}
34
Chandler Carruth17e0f402010-02-15 22:12:26 +000035// Instantiation of local classes with virtual functions.
36namespace local_class_with_virtual_functions {
37 template <typename T> struct X { };
38 template <typename T> struct Y { };
39
40 template <typename T>
41 void f() {
42 struct Z : public X<Y<T>*> {
43 virtual void g(Y<T>* y) { }
44 void g2(int x) {(void)x;}
45 };
46 Z z;
47 (void)z;
48 }
49
50 struct S { };
51 void test() { f<S>(); }
52}