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