xref: /llvm-project/clang/test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp (revision dd69ef38dba72b08bee83f262fd443743940d2bc)
19ca5c425SRichard Smith // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
23c74d41dSDouglas Gregor 
33c74d41dSDouglas Gregor template<typename T>
43c74d41dSDouglas Gregor struct X {
fX5a8b89d26SDouglas Gregor   void f() {}
63c74d41dSDouglas Gregor };
73c74d41dSDouglas Gregor 
8465841e4SRichard Smith template inline void X<int>::f(); // expected-error{{explicit instantiation cannot be 'inline'}}
93c74d41dSDouglas Gregor 
10465841e4SRichard Smith template<typename T>
11465841e4SRichard Smith struct Y {
fY12*dd69ef38SAaron Ballman   constexpr int f() { return 0; } // expected-warning{{C++14}}
13465841e4SRichard Smith };
14465841e4SRichard Smith 
15574f4f6aSRichard Smith template constexpr int Y<int>::f() const; // expected-error{{explicit instantiation cannot be 'constexpr'}}
167d137e3bSRichard Smith 
177d137e3bSRichard Smith template<typename T>
187d137e3bSRichard Smith struct Z {
197d137e3bSRichard Smith   enum E : T { e1, e2 };
207d137e3bSRichard Smith   T t; // expected-note {{refers here}}
217d137e3bSRichard Smith };
227d137e3bSRichard Smith 
237d137e3bSRichard Smith template enum Z<int>::E; // expected-error {{enumerations cannot be explicitly instantiated}}
247d137e3bSRichard Smith template int Z<int>::t; // expected-error {{explicit instantiation of 't' does not refer to}}
25