Debian Codegraph @

gcc/testsuite/g++.dg/ext/has-feature.C

raw
1 // { dg-do compile }
2 // { dg-options "" }
3
4 #define FEAT(x) (__has_feature(x) && __has_extension(x))
5 #define CXX11 (__cplusplus >= 201103L)
6 #define CXX14 (__cplusplus >= 201402L)
7
8 #if FEAT(cxx_exceptions) != !!__cpp_exceptions
9 #error
10 #endif
11
12 #if FEAT(cxx_rtti) != !!__cpp_rtti
13 #error
14 #endif
15
16 #if __has_feature (cxx_access_control_sfinae) != CXX11
17 #error
18 #endif
19
20 #if !__has_extension (cxx_access_control_sfinae)
21 #error
22 #endif
23
24 #if FEAT(cxx_alias_templates) != CXX11
25 #error
26 #endif
27
28 #if FEAT(cxx_alignas) != CXX11
29 #error
30 #endif
31
32 #if FEAT(cxx_alignof) != CXX11
33 #error
34 #endif
35
36 #if FEAT(cxx_attributes) != CXX11
37 #error
38 #endif
39
40 #if FEAT(cxx_constexpr) != CXX11
41 #error
42 #endif
43
44 #if FEAT(cxx_decltype) != CXX11
45 #error
46 #endif
47
48 #if FEAT(cxx_decltype_incomplete_return_types) != CXX11
49 #error
50 #endif
51
52 #if FEAT(cxx_default_function_template_args) != CXX11
53 #error
54 #endif
55
56 #if FEAT(cxx_defaulted_functions) != CXX11
57 #error
58 #endif
59
60 #if __has_feature (cxx_delegating_constructors) != CXX11
61 #error
62 #endif
63
64 #if FEAT (cxx_deleted_functions) != CXX11
65 #error
66 #endif
67
68 #if __has_feature (cxx_explicit_conversions) != CXX11
69 #error
70 #endif
71
72 #if FEAT (cxx_generalized_initializers) != CXX11
73 #error
74 #endif
75
76 #if FEAT (cxx_implicit_moves) != CXX11
77 #error
78 #endif
79
80 #if FEAT (cxx_inheriting_constructors) != CXX11
81 #error
82 #endif
83
84 #if !__has_extension (cxx_inline_namespaces)
85 #error
86 #endif
87
88 #if __has_feature (cxx_inline_namespaces) != CXX11
89 #error
90 #endif
91
92 #if FEAT (cxx_lambdas) != CXX11
93 #error
94 #endif
95
96 #if FEAT (cxx_local_type_template_args) != CXX11
97 #error
98 #endif
99
100 #if FEAT (cxx_noexcept) != CXX11
101 #error
102 #endif
103
104 #if __has_feature (cxx_nonstatic_member_init) != CXX11
105 #error
106 #endif
107
108 #if FEAT (cxx_nullptr) != CXX11
109 #error
110 #endif
111
112 #if __has_feature (cxx_override_control) != CXX11
113 #error
114 #endif
115
116 #if FEAT (cxx_reference_qualified_functions) != CXX11
117 #error
118 #endif
119
120 #if FEAT (cxx_range_for) != CXX11
121 #error
122 #endif
123
124 #if FEAT (cxx_raw_string_literals) != CXX11
125 #error
126 #endif
127
128 #if FEAT (cxx_rvalue_references) != CXX11
129 #error
130 #endif
131
132 #if FEAT (cxx_static_assert) != CXX11
133 #error
134 #endif
135
136 #if FEAT (cxx_thread_local) != CXX11
137 #error
138 #endif
139
140 #if FEAT (cxx_auto_type) != CXX11
141 #error
142 #endif
143
144 #if FEAT (cxx_strong_enums) != CXX11
145 #error
146 #endif
147
148 #if FEAT (cxx_trailing_return) != CXX11
149 #error
150 #endif
151
152 #if FEAT (cxx_unicode_literals) != CXX11
153 #error
154 #endif
155
156 #if FEAT (cxx_unrestricted_unions) != CXX11
157 #error
158 #endif
159
160 #if FEAT (cxx_user_literals) != CXX11
161 #error
162 #endif
163
164 #if !__has_extension (cxx_variadic_templates)
165 #error
166 #endif
167
168 #if __has_feature (cxx_variadic_templates) != CXX11
169 #error
170 #endif
171
172 #if !__has_extension (cxx_binary_literals)
173 #error
174 #endif
175
176 #if __has_feature (cxx_binary_literals) != CXX14
177 #error
178 #endif
179
180 #if FEAT (cxx_decltype_auto) != CXX14
181 #error
182 #endif
183
184 #if FEAT (cxx_aggregate_nsdmi) != CXX14
185 #error
186 #endif
187
188 #if __has_extension (cxx_init_captures) != CXX11
189 #error
190 #endif
191
192 #if __has_feature (cxx_init_captures) != CXX14
193 #error
194 #endif
195
196 #if FEAT (cxx_generic_lambdas) != CXX14
197 #error
198 #endif
199
200 #if FEAT (cxx_relaxed_constexpr) != CXX14
201 #error
202 #endif
203
204 #if FEAT (cxx_return_type_deduction) != CXX14
205 #error
206 #endif
207
208 #if __has_feature (cxx_variable_templates) != CXX14
209 #error
210 #endif