1 // { dg-do compile { target c++14 } }
2 // { dg-options "-I${srcdir}/g++.dg/cpp1y -I${srcdir}/g++.dg/cpp1y/testinc" }
8 #elif __cpp_rtti != 199711
9 # error "__cpp_rtti != 199711"
12 #ifndef __cpp_exceptions
13 # error "__cpp_exceptions"
14 #elif __cpp_exceptions != 199711
15 # error "__cpp_exceptions != 199711"
20 #ifndef __cpp_unicode_characters
21 # error "__cpp_unicode_characters"
22 #elif __cpp_unicode_characters != 200704
23 # error "__cpp_unicode_characters != 200704"
26 #ifndef __cpp_raw_strings
27 # error "__cpp_raw_strings"
28 #elif __cpp_raw_strings != 200710
29 # error "__cpp_raw_strings != 200710"
32 #ifndef __cpp_unicode_literals
33 # error "__cpp_unicode_literals"
34 #elif __cpp_unicode_literals != 200710
35 # error "__cpp_unicode_literals != 200710"
38 #ifndef __cpp_user_defined_literals
39 # error "__cpp_user_defined_literals"
40 #elif __cpp_user_defined_literals != 200809
41 # error "__cpp_user_defined_literals != 200809"
45 # error "__cpp_lambdas"
46 #elif __cpp_lambdas != 200907
47 # error "__cpp_lambdas != 200907"
50 #ifndef __cpp_constexpr
51 # error "__cpp_constexpr"
52 #elif __cpp_constexpr != 200704
53 # error "__cpp_constexpr != 200704"
56 #ifndef __cpp_range_based_for
57 # error "__cpp_range_based_for"
58 #elif __cpp_range_based_for != 200907
59 # error "__cpp_range_based_for != 200907"
62 #ifndef __cpp_static_assert
63 # error "__cpp_static_assert"
64 #elif __cpp_static_assert != 200410
65 # error "__cpp_static_assert != 200410"
68 #ifndef __cpp_decltype
69 # error "__cpp_decltype"
70 #elif __cpp_decltype != 200707
71 # error "__cpp_decltype != 200707"
74 #ifndef __cpp_attributes
75 # error "__cpp_attributes"
76 #elif __cpp_attributes != 200809
77 # error "__cpp_attributes != 200809"
80 #ifndef __cpp_rvalue_reference
81 # error "__cpp_rvalue_reference"
82 #elif __cpp_rvalue_reference != 200610
83 # error "__cpp_rvalue_reference != 200610"
86 #ifndef __cpp_variadic_templates
87 # error "__cpp_variadic_templates"
88 #elif __cpp_variadic_templates != 200704
89 # error "__cpp_variadic_templates != 200704"
92 #ifndef __cpp_initializer_lists
93 # error "__cpp_initializer_lists"
94 #elif __cpp_initializer_lists != 200806
95 # error "__cpp_initializer_lists != 200806"
98 #ifndef __cpp_delegating_constructors
99 # error "__cpp_delegating_constructors"
100 #elif __cpp_delegating_constructors != 200604
101 # error "__cpp_delegating_constructors != 200604"
105 # error "__cpp_nsdmi"
106 #elif __cpp_nsdmi != 200809
107 # error "__cpp_nsdmi != 200809"
110 #ifndef __cpp_inheriting_constructors
111 # error "__cpp_inheriting_constructors"
112 #elif __cpp_inheriting_constructors!= 200802
113 # error "__cpp_inheriting_constructors != 200802"
116 #ifndef __cpp_ref_qualifiers
117 # error "__cpp_ref_qualifiers"
118 #elif __cpp_ref_qualifiers != 200710
119 # error "__cpp_ref_qualifiers != 200710"
122 #ifndef __cpp_alias_templates
123 # error "__cpp_alias_templates"
124 #elif __cpp_alias_templates != 200704
125 # error "__cpp_alias_templates != 200704"
130 #ifndef __cpp_binary_literals
131 # error "__cpp_binary_literals"
132 #elif __cpp_binary_literals != 201304
133 # error "__cpp_binary_literals != 201304"
136 #ifndef __cpp_init_captures
137 # error "__cpp_init_captures"
138 #elif __cpp_init_captures != 201304
139 # error "__cpp_init_captures != 201304"
142 #ifndef __cpp_generic_lambdas
143 # error "__cpp_generic_lambdas"
144 #elif __cpp_generic_lambdas != 201304
145 # error "__cpp_generic_lambdas != 201304"
148 // TODO: Change 200704 to 201304 when C++14 constexpr goes in.
149 #ifndef __cpp_constexpr
150 # error "__cpp_constexpr"
151 #elif __cpp_constexpr != 200704
152 # error "__cpp_constexpr != 200704"
155 #ifndef __cpp_decltype_auto
156 # error "__cpp_decltype_auto"
157 #elif __cpp_decltype_auto != 201304
158 # error "__cpp_decltype_auto != 201304"
161 #ifndef __cpp_return_type_deduction
162 # error "__cpp_return_type_deduction"
163 #elif __cpp_return_type_deduction != 201304
164 # error "__cpp_return_type_deduction != 201304"
167 #ifndef __cpp_aggregate_nsdmi
168 # error "__cpp_aggregate_nsdmi"
169 #elif __cpp_aggregate_nsdmi != 201304
170 # error "__cpp_aggregate_nsdmi != 201304"
173 #ifndef __cpp_variable_templates
174 # error "__cpp_variable_templates"
175 #elif __cpp_variable_templates != 201304
176 # error "__cpp_variable_templates != 201304"
179 #ifndef __cpp_digit_separators
180 # error "__cpp_digit_separators"
181 #elif __cpp_digit_separators != 201309
182 # error "__cpp_digit_separators != 201309"
185 // Sized deallocation not in yet.
186 #ifdef __cpp_sized_deallocation
187 # error "__cpp_sized_deallocation"
192 #ifndef __cpp_runtime_arrays
193 # error "__cpp_runtime_arrays"
194 #elif __cpp_runtime_arrays != 198712
195 # error "__cpp_runtime_arrays != 198712"
200 #ifdef __has_cpp_attribute
201 # if ! __has_cpp_attribute(noreturn)
202 # error "__has_cpp_attribute(noreturn)"
203 # elif __has_cpp_attribute(noreturn) != 200809
204 # error "__has_cpp_attribute(noreturn) != 200809"
207 # error "__has_cpp_attribute"
210 // Attribute carries_dependency not in yet.
211 //#ifdef __has_cpp_attribute
212 //# if ! __has_cpp_attribute(carries_dependency)
213 //# error "__has_cpp_attribute(carries_dependency)"
214 //# elif __has_cpp_attribute(carries_dependency) != 200809
215 //# error "__has_cpp_attribute(carries_dependency) != 200809"
218 //# error "__has_cpp_attribute"
223 #ifdef __has_cpp_attribute
224 # if ! __has_cpp_attribute(deprecated)
225 # error "__has_cpp_attribute(deprecated)"
226 # elif __has_cpp_attribute(deprecated) != 201309
227 # error "__has_cpp_attribute(deprecated) != 201309"
230 # error "__has_cpp_attribute"
235 // Check for __has_include macro.
236 #ifndef __has_include
237 # error "__has_include"
240 // Quoted complex.h should find at least the bracket version (use operator).
241 #if __has_include__ "complex.h"
246 // Try known bracket header (use operator).
247 #if __has_include__(<complex>)
252 // Define and use a macro to invoke the operator.
253 #define sluggo(TXT) __has_include__(TXT)
255 #if sluggo(<complex>)
260 #if ! sluggo(<complex>)
265 // Quoted complex.h should find at least the bracket version.
266 #if __has_include("complex.h")
271 // Try known local quote header.
272 #if __has_include("complex_literals.h")
274 # error "\"complex_literals.h\""
277 // Try nonexistent bracket header.
278 #if __has_include(<stuff>)
283 // Try nonexistent quote header.
284 #if __has_include("phlegm")
289 // Test __has_include_next.
290 #if __has_include("phoobhar.h")
291 # include "phoobhar.h"
293 # error "__has_include(\"phoobhar.h\")"
297 #define COMPLEX_INC "complex.h"
298 #if __has_include(COMPLEX_INC)
303 // Realistic use of __has_include.
304 #if __has_include(<array>)
307 template<typename _Tp, size_t _Num>
308 using array = std::array<_Tp, _Num>;
309 #elif __has_include(<tr1/array>)
311 # include <tr1/array>
312 template<typename _Tp, size_t _Num>
313 typedef std::tr1::array<_Tp, _Num> array;