Home | History | Annotate | Download | only in SemaTemplate
      1 // RUN: %clang_cc1 -verify %s
      2 template<typename T>
      3 void f0() {
      4   struct X;
      5   typedef struct Y {
      6     T (X::* f1())(int) { return 0; }
      7   } Y2;
      8 
      9   Y2 y = Y();
     10 }
     11 
     12 template void f0<int>();
     13 
     14 // PR5764
     15 namespace PR5764 {
     16   struct X {
     17     template <typename T>
     18     void Bar() {
     19       typedef T ValueType;
     20       struct Y {
     21         Y() { V = ValueType(); }
     22 
     23         ValueType V;
     24       };
     25 
     26       Y y;
     27     }
     28   };
     29 
     30   void test(X x) {
     31     x.Bar<int>();
     32   }
     33 }
     34 
     35 // Instantiation of local classes with virtual functions.
     36 namespace 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 }
     53 
     54 namespace PR8801 {
     55   template<typename T>
     56   void foo() {
     57     class X;
     58     typedef int (X::*pmf_type)();
     59     class X : public T { };
     60 
     61     pmf_type pmf = &T::foo;
     62   }
     63 
     64   struct Y { int foo(); };
     65 
     66   template void foo<Y>();
     67 }
     68