| 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | |
| 3 | template<typename T> |
| 4 | struct X0 { |
| 5 | void f(T&); |
| 6 | |
| 7 | struct Inner; |
| 8 | |
| 9 | static T static_var; |
| 10 | }; |
| 11 | |
| 12 | template<typename T> |
| 13 | void X0<T>::f(T& t) { |
| 14 | t = 1; // expected-error{{incompatible type}} |
| 15 | } |
| 16 | |
| 17 | template<typename T> |
| 18 | struct X0<T>::Inner { |
| 19 | T member; |
| 20 | }; |
| 21 | |
| 22 | template<typename T> |
| 23 | T X0<T>::static_var = 1; // expected-error{{cannot initialize}} |
| 24 | |
| 25 | extern template struct X0<void*>; |
| 26 | template struct X0<void*>; // expected-note 2{{instantiation}} |
| 27 | |
| 28 | template struct X0<int>; // expected-note 4{{explicit instantiation definition is here}} |
| 29 | |
| 30 | extern template void X0<int>::f(int&); // expected-error{{follows explicit instantiation definition}} |
| 31 | extern template struct X0<int>::Inner; // expected-error{{follows explicit instantiation definition}} |
| 32 | extern template int X0<int>::static_var; // expected-error{{follows explicit instantiation definition}} |
| 33 | extern template struct X0<int>; // expected-error{{follows explicit instantiation definition}} |
| 34 | |