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