1 // { dg-do compile { target c++14 } }
2 // { dg-options "-I${srcdir}/g++.dg/cpp1y -I${srcdir}/g++.dg/cpp1y/testinc" }
6 #ifndef __cpp_unicode_characters
7 # error "__cpp_unicode_characters"
8 #elif __cpp_unicode_characters != 200704
9 # error "__cpp_unicode_characters != 200704"
12 #ifndef __cpp_raw_strings
13 # error "__cpp_raw_strings"
14 #elif __cpp_raw_strings != 200710
15 # error "__cpp_raw_strings != 200710"
18 #ifndef __cpp_unicode_literals
19 # error "__cpp_unicode_literals"
20 #elif __cpp_unicode_literals != 200710
21 # error "__cpp_unicode_literals != 200710"
24 #ifndef __cpp_user_defined_literals
25 # error "__cpp_user_defined_literals"
26 #elif __cpp_user_defined_literals != 200809
27 # error "__cpp_user_defined_literals != 200809"
31 # error "__cpp_lambdas"
32 #elif __cpp_lambdas != 200907
33 # error "__cpp_lambdas != 200907"
36 #ifndef __cpp_constexpr
37 # error "__cpp_constexpr"
38 #elif __cpp_constexpr != 200704
39 # error "__cpp_constexpr != 200704"
42 #ifndef __cpp_static_assert
43 # error "__cpp_static_assert"
44 #elif __cpp_static_assert != 200410
45 # error "__cpp_static_assert != 200410"
48 #ifndef __cpp_decltype
49 # error "__cpp_decltype"
50 #elif __cpp_decltype != 200707
51 # error "__cpp_decltype != 200707"
54 #ifndef __cpp_attributes
55 # error "__cpp_attributes"
56 #elif __cpp_attributes != 200809
57 # error "__cpp_attributes != 200809"
60 #ifndef __cpp_rvalue_reference
61 # error "__cpp_rvalue_reference"
62 #elif __cpp_rvalue_reference != 200610
63 # error "__cpp_rvalue_reference != 200610"
66 #ifndef __cpp_variadic_templates
67 # error "__cpp_variadic_templates"
68 #elif __cpp_variadic_templates != 200704
69 # error "__cpp_variadic_templates != 200704"
72 #ifndef __cpp_alias_templates
73 # error "__cpp_alias_templates"
74 #elif __cpp_alias_templates != 200704
75 # error "__cpp_alias_templates != 200704"
80 #ifndef __cpp_binary_literals
81 # error "__cpp_binary_literals"
82 #elif __cpp_binary_literals != 201304
83 # error "__cpp_binary_literals != 201304"
86 #ifndef __cpp_init_captures
87 # error "__cpp_init_captures"
88 #elif __cpp_init_captures != 201304
89 # error "__cpp_init_captures != 201304"
92 #ifndef __cpp_generic_lambdas
93 # error "__cpp_generic_lambdas"
94 #elif __cpp_generic_lambdas != 201304
95 # error "__cpp_generic_lambdas != 201304"
98 // TODO: Change 200704 to 201304 when C++14 constexpr goes in.
99 #ifndef __cpp_constexpr
100 # error "__cpp_constexpr"
101 #elif __cpp_constexpr != 200704
102 # error "__cpp_constexpr != 200704"
105 #ifndef __cpp_decltype_auto
106 # error "__cpp_decltype_auto"
107 #elif __cpp_decltype_auto != 201304
108 # error "__cpp_decltype_auto != 201304"
111 #ifndef __cpp_return_type_deduction
112 # error "__cpp_return_type_deduction"
113 #elif __cpp_return_type_deduction != 201304
114 # error "__cpp_return_type_deduction != 201304"
117 #ifndef __cpp_runtime_arrays
118 # error "__cpp_runtime_arrays"
119 #elif __cpp_runtime_arrays != 201304
120 # error "__cpp_runtime_arrays != 201304"
123 // Aggregate initializers not in yet.
124 #ifdef __cpp_aggregate_nsdmi
125 # error "__cpp_aggregate_nsdmi"
128 #ifndef __cpp_variable_templates
129 # error "__cpp_variable_templates"
130 #elif __cpp_variable_templates != 201304
131 # error "__cpp_variable_templates != 201304"
134 #ifndef __cpp_digit_separators
135 # error "__cpp_digit_separators"
136 #elif __cpp_digit_separators != 201309
137 # error "__cpp_digit_separators != 201309"
140 #ifndef __cpp_attribute_deprecated
141 # error "__cpp_attribute_deprecated"
142 #elif __cpp_attribute_deprecated != 201309
143 # error "__cpp_attribute_deprecated != 201309"
146 // Sized deallocation not in yet.
147 #ifdef __cpp_sized_deallocation
148 # error "__cpp_sized_deallocation"
151 // Begin include checks.
153 // Check for __has_include macro.
154 #ifndef __has_include
155 # error "__has_include"
158 // Quoted complex.h should find at least the bracket version (use operator).
159 #if __has_include__ "complex.h"
164 // Try known bracket header (use operator).
165 #if __has_include__(<complex>)
170 // Define and use a macro to invoke the operator.
171 #define sluggo(TXT) __has_include__(TXT)
173 #if sluggo(<complex>)
178 #if ! sluggo(<complex>)
183 // Quoted complex.h should find at least the bracket version.
184 #if __has_include("complex.h")
189 // Try known local quote header.
190 #if __has_include("complex_literals.h")
192 # error "\"complex_literals.h\""
195 // Try nonexistent bracket header.
196 #if __has_include(<stuff>)
201 // Try nonexistent quote header.
202 #if __has_include("phlegm")
207 // Test __has_include_next.
208 #if __has_include("phoobhar.h")
209 # include "phoobhar.h"
211 # error "__has_include(\"phoobhar.h\")"
215 #define COMPLEX_INC "complex.h"
216 #if __has_include(COMPLEX_INC)
221 // Realistic use of __has_include.
222 #if __has_include(<array>)
225 template<typename _Tp, size_t _Num>
226 using array = std::array<_Tp, _Num>;
227 #elif __has_include(<tr1/array>)
229 # include <tr1/array>
230 template<typename _Tp, size_t _Num>
231 typedef std::tr1::array<_Tp, _Num> array;