xref: /llvm-project/clang/test/CXX/temp/temp.spec/temp.explicit/p8.cpp (revision 4b38ded66a5556117245b5db76e2c27363a85305)
1*4b38ded6SRichard Smith // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
21d957a33SDouglas Gregor 
31d957a33SDouglas Gregor template<typename T>
41d957a33SDouglas Gregor struct X0 {
51d957a33SDouglas Gregor   struct MemberClass;
61d957a33SDouglas Gregor 
71d957a33SDouglas Gregor   T* f0(T* ptr);
81d957a33SDouglas Gregor 
91d957a33SDouglas Gregor   static T* static_member;
101d957a33SDouglas Gregor };
111d957a33SDouglas Gregor 
12*4b38ded6SRichard Smith template class X0<int(int)>; // ok; nothing gets instantiated.
131d957a33SDouglas Gregor 
141d957a33SDouglas Gregor template<typename T>
151d957a33SDouglas Gregor struct X0<T>::MemberClass {
161d957a33SDouglas Gregor   T member;
171d957a33SDouglas Gregor };
181d957a33SDouglas Gregor 
191d957a33SDouglas Gregor template<typename T>
f0(T * ptr)201d957a33SDouglas Gregor T* X0<T>::f0(T* ptr) {
211d957a33SDouglas Gregor   return ptr + 1;
221d957a33SDouglas Gregor }
231d957a33SDouglas Gregor 
241d957a33SDouglas Gregor template<typename T>
251d957a33SDouglas Gregor T* X0<T>::static_member = 0;
261d957a33SDouglas Gregor 
27*4b38ded6SRichard Smith template class X0<int>; // ok
28*4b38ded6SRichard Smith 
29*4b38ded6SRichard Smith 
30*4b38ded6SRichard Smith template<typename T>
31*4b38ded6SRichard Smith struct X1 {
32*4b38ded6SRichard Smith   enum class E {
33*4b38ded6SRichard Smith     e = T::error // expected-error 2{{no members}}
34*4b38ded6SRichard Smith   };
35*4b38ded6SRichard Smith };
36*4b38ded6SRichard Smith template struct X1<int>; // expected-note {{here}}
37*4b38ded6SRichard Smith 
38*4b38ded6SRichard Smith extern template struct X1<char>; // ok
39*4b38ded6SRichard Smith 
40*4b38ded6SRichard Smith template struct X1<char>; // expected-note {{here}}
41