1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
3 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
9 T value
; // expected-error{{incomplete}}
12 // Explicitly instantiate a class template specialization
13 template struct X0
<int>;
14 template struct X0
<void>; // expected-note{{instantiation}}
16 // Explicitly instantiate a function template specialization
19 ++t
; // expected-error{{cannot increment}}
22 template void f0(int);
23 template void f0
<long>(long);
24 template void f0
<>(unsigned);
25 template void f0(int C::*); // expected-note{{instantiation}}
27 // Explicitly instantiate a member template specialization
33 U member2
; // expected-error{{incomplete}}
38 t
= u
; // expected-error{{incompatible}}
42 template struct X1
<int>::Inner
<float>;
43 template struct X1
<int>::Inner
<double>;
44 template struct X1
<int>::Inner
<void>; // expected-note{{instantiation}}
46 template void X1
<int>::f(int&, float);
47 template void X1
<int>::f
<long>(int&, long);
48 template void X1
<int>::f
<>(int&, double);
49 template void X1
<int>::f
<>(int&, int*); // expected-note{{instantiation}}
51 // Explicitly instantiate members of a class template
52 struct Incomplete
; // expected-note{{forward declaration}}
53 struct NonDefaultConstructible
{ // expected-note{{candidate constructor (the implicit copy constructor) not viable}}
54 #if __cplusplus >= 201103L // C++11 or later
55 // expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}}
57 NonDefaultConstructible(int); // expected-note{{candidate constructor}}
60 template<typename T
, typename U
>
63 t
= u
; // expected-error{{incompatible}}
68 U member2
; // expected-error{{incomplete}}
71 static T static_member1
;
72 static U static_member2
;
75 template<typename T
, typename U
>
76 T X2
<T
, U
>::static_member1
= 17; // expected-error{{cannot initialize}}
78 template<typename T
, typename U
>
79 U X2
<T
, U
>::static_member2
; // expected-error{{no matching}}
81 template void X2
<int, float>::f(int &, float);
82 template void X2
<int, float>::f(int &, double); // expected-error{{does not refer}}
83 template void X2
<int, int*>::f(int&, int*); // expected-note{{instantiation}}
85 template struct X2
<int, float>::Inner
;
86 template struct X2
<int, Incomplete
>::Inner
; // expected-note{{instantiation}}
88 template int X2
<int, float>::static_member1
;
89 template int* X2
<int*, float>::static_member1
; // expected-note{{instantiation}}
91 NonDefaultConstructible X2
<NonDefaultConstructible
, int>::static_member1
;
94 NonDefaultConstructible X2
<int, NonDefaultConstructible
>::static_member2
; // expected-note{{instantiation}}