[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / CXX / temp / temp.spec / temp.expl.spec / p4.cpp
blobac040ccb3d6458675149a294b6f2304296c8f28c
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
3 // RUN: %clang_cc1 -fsyntax-only -verify %s
5 struct IntHolder { // expected-note 0-1{{here}} expected-note 2-4{{candidate constructor (the implicit}}
6 IntHolder(int); // expected-note 2{{candidate constructor}}
7 };
9 template<typename T, typename U>
10 struct X { // expected-note{{here}}
11 void f() {
12 T t; // expected-error{{no matching}}
15 void g() { }
17 struct Inner {
18 #if __cplusplus >= 201103L
19 T value; // expected-note {{has no default constructor}}
20 #else
21 // expected-error@-4 {{implicit default}}
22 T value; // expected-note {{member is declared here}}
23 #endif
26 static T value;
29 template<typename T, typename U>
30 T X<T, U>::value; // expected-error{{no matching constructor}}
32 IntHolder &test_X_IntHolderInt(X<IntHolder, int> xih) {
33 xih.g(); // okay
34 xih.f(); // expected-note{{instantiation}}
36 X<IntHolder, int>::Inner inner;
37 #if __cplusplus >= 201103L
38 // expected-error@-2 {{call to implicitly-deleted}}
39 #else
40 // expected-note@-4 {{first required here}}
41 #endif
43 return X<IntHolder, int>::value; // expected-note{{instantiation}}
46 // Explicitly specialize the members of X<IntHolder, long> to not cause
47 // problems with instantiation.
48 template<>
49 void X<IntHolder, long>::f() { }
51 template<>
52 struct X<IntHolder, long>::Inner {
53 Inner() : value(17) { }
54 IntHolder value;
57 template<>
58 IntHolder X<IntHolder, long>::value = 17;
60 IntHolder &test_X_IntHolderInt(X<IntHolder, long> xih) {
61 xih.g(); // okay
62 xih.f(); // okay, uses specialization
64 X<IntHolder, long>::Inner inner; // okay, uses specialization
66 return X<IntHolder, long>::value; // okay, uses specialization
69 template<>
70 X<IntHolder, long>::X() { } // expected-error{{instantiated member}}