Debian Codegraph @

gcc/testsuite/g++.dg/ext/unary_trait_incomplete.C

raw
1 // PR c++/39475
2
3 struct I; // { dg-message "forward declaration" }
4 struct C { };
5 union U; // { dg-message "forward declaration" }
6
7 bool nas1 = __has_nothrow_assign(I); // { dg-error "incomplete type" }
8 bool nas2 = __has_nothrow_assign(C[]);
9 bool nas3 = __has_nothrow_assign(I[]);
10 bool nas4 = __has_nothrow_assign(void);
11 bool nas5 = __has_nothrow_assign(const void);
12
13 bool tas1 = __has_trivial_assign(I); // { dg-error "incomplete type" }
14 bool tas2 = __has_trivial_assign(C[]);
15 bool tas3 = __has_trivial_assign(I[]);
16 bool tas4 = __has_trivial_assign(void);
17 bool tas5 = __has_trivial_assign(const void);
18
19 bool nco1 = __has_nothrow_constructor(I); // { dg-error "incomplete type" }
20 bool nco2 = __has_nothrow_constructor(C[]);
21 bool nco3 = __has_nothrow_constructor(I[]);
22 bool nco4 = __has_nothrow_constructor(void);
23 bool nco5 = __has_nothrow_constructor(const void);
24
25 bool tco1 = __has_trivial_constructor(I); // { dg-error "incomplete type" }
26 bool tco2 = __has_trivial_constructor(C[]);
27 bool tco3 = __has_trivial_constructor(I[]);
28 bool tco4 = __has_trivial_constructor(void);
29 bool tco5 = __has_trivial_constructor(const void);
30
31 bool ncp1 = __has_nothrow_copy(I); // { dg-error "incomplete type" }
32 bool ncp2 = __has_nothrow_copy(C[]);
33 bool ncp3 = __has_nothrow_copy(I[]);
34 bool ncp4 = __has_nothrow_copy(void);
35 bool ncp5 = __has_nothrow_copy(const void);
36
37 bool tcp1 = __has_trivial_copy(I); // { dg-error "incomplete type" }
38 bool tcp2 = __has_trivial_copy(C[]);
39 bool tcp3 = __has_trivial_copy(I[]);
40 bool tcp4 = __has_trivial_copy(void);
41 bool tcp5 = __has_trivial_copy(const void);
42
43 bool tde1 = __has_trivial_destructor(I); // { dg-error "incomplete type" }
44 bool tde2 = __has_trivial_destructor(C[]);
45 bool tde3 = __has_trivial_destructor(I[]);
46 bool tde4 = __has_trivial_destructor(void);
47 bool tde5 = __has_trivial_destructor(const void);
48
49 // T shall be a complete type, cv void, or an array of unknown bound.
50
51 bool con1 = __is_constructible(C);
52 bool con2 = __is_constructible(I); // { dg-error "incomplete type" }
53 bool con3 = __is_constructible(U); // { dg-error "incomplete type" }
54 bool con4 = __is_constructible(C[]);
55 bool con5 = __is_constructible(I[]);
56 bool con6 = __is_constructible(U[]);
57 bool con7 = __is_constructible(C[1]);
58 bool con8 = __is_constructible(I[1]); // { dg-error "incomplete type" }
59 bool con9 = __is_constructible(U[1]); // { dg-error "incomplete type" }
60 bool con10 = __is_constructible(void);
61 bool con11 = __is_constructible(const void);
62
63 // If T is a non-union class type, T shall be a complete type.
64
65 bool vde1 = __has_virtual_destructor(I); // { dg-error "incomplete type" }
66 bool vde2 = __has_virtual_destructor(U);
67 bool vde3 = __has_virtual_destructor(C[]);
68 bool vde4 = __has_virtual_destructor(I[]);
69 bool vde5 = __has_virtual_destructor(U[]);
70 bool vde6 = __has_virtual_destructor(C[1]);
71 bool vde7 = __has_virtual_destructor(I[1]);
72 bool vde8 = __has_virtual_destructor(U[1]);
73 bool vde9 = __has_virtual_destructor(void);
74 bool vde10 = __has_virtual_destructor(const void);
75
76 bool abs1 = __is_abstract(I); // { dg-error "incomplete type" }
77 bool abs2 = __is_abstract(U);
78 bool abs3 = __is_abstract(C[]);
79 bool abs4 = __is_abstract(I[]);
80 bool abs5 = __is_abstract(U[]);
81 bool abs6 = __is_abstract(C[1]);
82 bool abs7 = __is_abstract(I[1]);
83 bool abs8 = __is_abstract(U[1]);
84 bool abs9 = __is_abstract(void);
85 bool abs10 = __is_abstract(const void);
86
87 bool emp1 = __is_empty(I); // { dg-error "incomplete type" }
88 bool emp2 = __is_empty(U);
89 bool emp3 = __is_empty(C[]);
90 bool emp4 = __is_empty(I[]);
91 bool emp5 = __is_empty(U[]);
92 bool emp6 = __is_empty(C[1]);
93 bool emp7 = __is_empty(I[1]);
94 bool emp8 = __is_empty(U[1]);
95 bool emp9 = __is_empty(void);
96 bool emp10 = __is_empty(const void);
97
98 bool pol1 = __is_polymorphic(I); // { dg-error "incomplete type" }
99 bool pol2 = __is_polymorphic(U);
100 bool pol3 = __is_polymorphic(C[]);
101 bool pol4 = __is_polymorphic(I[]);
102 bool pol5 = __is_polymorphic(U[]);
103 bool pol6 = __is_polymorphic(C[1]);
104 bool pol7 = __is_polymorphic(I[1]);
105 bool pol8 = __is_polymorphic(U[1]);
106 bool pol9 = __is_polymorphic(void);
107 bool pol10 = __is_polymorphic(const void);
108
109 // If T is a class type, T shall be a complete type.
110
111 bool agg1 = __is_aggregate(I); // { dg-error "incomplete type" }
112 bool agg2 = __is_aggregate(U); // { dg-error "incomplete type" }
113 bool agg3 = __is_aggregate(C[]);
114 bool agg4 = __is_aggregate(I[]);
115 bool agg5 = __is_aggregate(U[]);
116 bool agg6 = __is_aggregate(C[1]);
117 bool agg7 = __is_aggregate(I[1]);
118 bool agg8 = __is_aggregate(U[1]);
119 bool agg9 = __is_aggregate(void);
120 bool agg10 = __is_aggregate(const void);
121
122 bool fin1 = __is_final(I); // { dg-error "incomplete type" }
123 bool fin2 = __is_final(U); // { dg-error "incomplete type" }
124 bool fin3 = __is_final(C[]);
125 bool fin4 = __is_final(I[]);
126 bool fin5 = __is_final(U[]);
127 bool fin6 = __is_final(C[1]);
128 bool fin7 = __is_final(I[1]);
129 bool fin8 = __is_final(U[1]);
130 bool fin9 = __is_final(void);
131 bool fin10 = __is_final(const void);
132
133 // remove_all_extents_t<T> shall be a complete type or cv void.
134
135 bool pod1 = __is_pod(I); // { dg-error "incomplete type" }
136 bool pod2 = __is_pod(U); // { dg-error "incomplete type" }
137 bool pod3 = __is_pod(C[]);
138 bool pod4 = __is_pod(I[]); // { dg-error "incomplete type" }
139 bool pod5 = __is_pod(U[]); // { dg-error "incomplete type" }
140 bool pod6 = __is_pod(C[1]);
141 bool pod7 = __is_pod(I[1]); // { dg-error "incomplete type" }
142 bool pod8 = __is_pod(U[1]); // { dg-error "incomplete type" }
143 bool pod9 = __is_pod(void);
144 bool pod10 = __is_pod(const void);