[SLP]Propagate AssumptionCache where possible
[llvm-project.git] / clang / test / CXX / temp / temp.spec / temp.expl.spec / p6.cpp
blobf5394713968811785e4daf6a12d612a40b9adf1a
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 template<typename T>
4 struct X0 {
5 void f();
7 template<typename U>
8 void g(U);
10 struct Nested {
13 static T member;
16 int &use_X0_int(X0<int> x0i, // expected-note{{implicit instantiation first required here}}
17 int i) {
18 x0i.f(); // expected-note{{implicit instantiation first required here}}
19 x0i.g(i); // expected-note{{implicit instantiation first required here}}
20 X0<int>::Nested nested; // expected-note{{implicit instantiation first required here}}
21 return X0<int>::member; // expected-note{{implicit instantiation first required here}}
24 template<>
25 void X0<int>::f() { // expected-error{{after instantiation}}
28 template<> template<>
29 void X0<int>::g(int) { // expected-error{{after instantiation}}
32 template<>
33 struct X0<int>::Nested { }; // expected-error{{after instantiation}}
35 template<>
36 int X0<int>::member = 17; // expected-error{{after instantiation}}
38 template<>
39 struct X0<int> { }; // expected-error{{after instantiation}}
41 // Example from the standard
42 template<class T> class Array { /* ... */ };
44 template<class T> void sort(Array<T>& v) { /* ... */ }
46 struct String {};
48 void f(Array<String>& v) {
50 sort(v); // expected-note{{required}}
51 // use primary template
52 // sort(Array<T>&), T is String
55 template<> void sort<String>(Array<String>& v); // // expected-error{{after instantiation}}
56 template<> void sort<>(Array<char*>& v); // OK: sort<char*> not yet used
58 namespace PR6160 {
59 template<typename T> void f(T);
60 template<> void f(int);
61 extern template void f(int);
62 template<> void f(int) { }