1// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3template<typename T>
4class X0 {
5public:
6  void f(T t);
7
8  struct Inner {
9    void g(T t);
10  };
11};
12
13template<typename T>
14void X0<T>::f(T t) {
15  t = 17; // expected-error{{incompatible}}
16}
17
18extern template class X0<int>;
19
20extern template class X0<int*>;
21
22template<typename T>
23void X0<T>::Inner::g(T t) {
24  t = 17; // expected-error{{incompatible}}
25}
26
27void test_intptr(X0<int*> xi, X0<int*>::Inner xii) {
28  xi.f(0);
29  xii.g(0);
30}
31
32extern template class X0<long*>;
33
34void test_longptr(X0<long*> xl, X0<long*>::Inner xli) {
35  xl.f(0);
36  xli.g(0);
37}
38
39template class X0<long*>; // expected-note 2{{instantiation}}
40
41template<typename T>
42class X1 {
43public:
44  void f(T t) { t += 2; }
45
46  void g(T t);
47};
48
49template<typename T>
50void X1<T>::g(T t) {
51  t += 2;
52}
53
54extern template class X1<void*>;
55
56void g_X1(X1<void*> x1, void *ptr) {
57  x1.g(ptr);
58}
59
60extern template void X1<const void*>::g(const void*);
61
62void g_X1_2(X1<const void *> x1, const void *ptr) {
63  x1.g(ptr);
64}
65