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