1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -verify %s 2*f4a2713aSLionel Sambuc // expected-no-diagnostics 3*f4a2713aSLionel Sambuc template<typename T> 4*f4a2713aSLionel Sambuc void f0() { 5*f4a2713aSLionel Sambuc struct X; 6*f4a2713aSLionel Sambuc typedef struct Y { 7*f4a2713aSLionel Sambuc T (X::* f1())(int) { return 0; } 8*f4a2713aSLionel Sambuc } Y2; 9*f4a2713aSLionel Sambuc 10*f4a2713aSLionel Sambuc Y2 y = Y(); 11*f4a2713aSLionel Sambuc } 12*f4a2713aSLionel Sambuc 13*f4a2713aSLionel Sambuc template void f0<int>(); 14*f4a2713aSLionel Sambuc 15*f4a2713aSLionel Sambuc // PR5764 16*f4a2713aSLionel Sambuc namespace PR5764 { 17*f4a2713aSLionel Sambuc struct X { 18*f4a2713aSLionel Sambuc template <typename T> 19*f4a2713aSLionel Sambuc void Bar() { 20*f4a2713aSLionel Sambuc typedef T ValueType; 21*f4a2713aSLionel Sambuc struct Y { 22*f4a2713aSLionel Sambuc Y() { V = ValueType(); } 23*f4a2713aSLionel Sambuc 24*f4a2713aSLionel Sambuc ValueType V; 25*f4a2713aSLionel Sambuc }; 26*f4a2713aSLionel Sambuc 27*f4a2713aSLionel Sambuc Y y; 28*f4a2713aSLionel Sambuc } 29*f4a2713aSLionel Sambuc }; 30*f4a2713aSLionel Sambuc 31*f4a2713aSLionel Sambuc void test(X x) { 32*f4a2713aSLionel Sambuc x.Bar<int>(); 33*f4a2713aSLionel Sambuc } 34*f4a2713aSLionel Sambuc } 35*f4a2713aSLionel Sambuc 36*f4a2713aSLionel Sambuc // Instantiation of local classes with virtual functions. 37*f4a2713aSLionel Sambuc namespace local_class_with_virtual_functions { 38*f4a2713aSLionel Sambuc template <typename T> struct X { }; 39*f4a2713aSLionel Sambuc template <typename T> struct Y { }; 40*f4a2713aSLionel Sambuc 41*f4a2713aSLionel Sambuc template <typename T> 42*f4a2713aSLionel Sambuc void f() { 43*f4a2713aSLionel Sambuc struct Z : public X<Y<T>*> { 44*f4a2713aSLionel Sambuc virtual void g(Y<T>* y) { } 45*f4a2713aSLionel Sambuc void g2(int x) {(void)x;} 46*f4a2713aSLionel Sambuc }; 47*f4a2713aSLionel Sambuc Z z; 48*f4a2713aSLionel Sambuc (void)z; 49*f4a2713aSLionel Sambuc } 50*f4a2713aSLionel Sambuc 51*f4a2713aSLionel Sambuc struct S { }; 52*f4a2713aSLionel Sambuc void test() { f<S>(); } 53*f4a2713aSLionel Sambuc } 54*f4a2713aSLionel Sambuc 55*f4a2713aSLionel Sambuc namespace PR8801 { 56*f4a2713aSLionel Sambuc template<typename T> 57*f4a2713aSLionel Sambuc void foo() { 58*f4a2713aSLionel Sambuc class X; 59*f4a2713aSLionel Sambuc typedef int (X::*pmf_type)(); 60*f4a2713aSLionel Sambuc class X : public T { }; 61*f4a2713aSLionel Sambuc 62*f4a2713aSLionel Sambuc pmf_type pmf = &T::foo; 63*f4a2713aSLionel Sambuc } 64*f4a2713aSLionel Sambuc 65*f4a2713aSLionel Sambuc struct Y { int foo(); }; 66*f4a2713aSLionel Sambuc 67*f4a2713aSLionel Sambuc template void foo<Y>(); 68*f4a2713aSLionel Sambuc } 69