111
|
1 // { dg-do compile }
|
|
2 // { dg-options "-std=gnu++11" }
|
|
3
|
|
4 // C++98 features:
|
|
5
|
|
6 #ifndef __cpp_rtti
|
|
7 # error "__cpp_rtti"
|
|
8 #elif __cpp_rtti != 199711
|
|
9 # error "__cpp_rtti != 199711"
|
|
10 #endif
|
|
11
|
|
12 #ifndef __cpp_exceptions
|
|
13 # error "__cpp_exceptions"
|
|
14 #elif __cpp_exceptions != 199711
|
|
15 # error "__cpp_exceptions != 199711"
|
|
16 #endif
|
|
17
|
|
18 // C++11 features:
|
|
19
|
|
20 #ifndef __cpp_unicode_characters
|
|
21 # error "__cpp_unicode_characters"
|
|
22 #elif __cpp_unicode_characters != 200704
|
|
23 # error "__cpp_unicode_characters != 200704"
|
|
24 #endif
|
|
25
|
|
26 #ifndef __cpp_raw_strings
|
|
27 # error "__cpp_raw_strings"
|
|
28 #elif __cpp_raw_strings != 200710
|
|
29 # error "__cpp_raw_strings != 200710"
|
|
30 #endif
|
|
31
|
|
32 #ifndef __cpp_unicode_literals
|
|
33 # error "__cpp_unicode_literals"
|
|
34 #elif __cpp_unicode_literals != 200710
|
|
35 # error "__cpp_unicode_literals != 200710"
|
|
36 #endif
|
|
37
|
|
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"
|
|
42 #endif
|
|
43
|
|
44 #ifndef __cpp_lambdas
|
|
45 # error "__cpp_lambdas"
|
|
46 #elif __cpp_lambdas != 200907
|
|
47 # error "__cpp_lambdas != 200907"
|
|
48 #endif
|
|
49
|
|
50 #ifndef __cpp_constexpr
|
|
51 # error "__cpp_constexpr"
|
|
52 #elif __cpp_constexpr != 200704
|
|
53 # error "__cpp_constexpr != 200704"
|
|
54 #endif
|
|
55
|
|
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"
|
|
60 #endif
|
|
61
|
|
62 #ifndef __cpp_static_assert
|
|
63 # error "__cpp_static_assert"
|
|
64 #elif __cpp_static_assert != 200410
|
|
65 # error "__cpp_static_assert != 200410"
|
|
66 #endif
|
|
67
|
|
68 #ifndef __cpp_decltype
|
|
69 # error "__cpp_decltype"
|
|
70 #elif __cpp_decltype != 200707
|
|
71 # error "__cpp_decltype != 200707"
|
|
72 #endif
|
|
73
|
|
74 #ifndef __cpp_attributes
|
|
75 # error "__cpp_attributes"
|
|
76 #elif __cpp_attributes != 200809
|
|
77 # error "__cpp_attributes != 200809"
|
|
78 #endif
|
|
79
|
|
80 #ifndef __cpp_rvalue_references
|
|
81 # error "__cpp_rvalue_references"
|
|
82 #elif __cpp_rvalue_references != 200610
|
|
83 # error "__cpp_rvalue_references != 200610"
|
|
84 #endif
|
|
85
|
|
86 #ifndef __cpp_variadic_templates
|
|
87 # error "__cpp_variadic_templates"
|
|
88 #elif __cpp_variadic_templates != 200704
|
|
89 # error "__cpp_variadic_templates != 200704"
|
|
90 #endif
|
|
91
|
|
92 #ifndef __cpp_initializer_lists
|
|
93 # error "__cpp_initializer_lists"
|
|
94 #elif __cpp_initializer_lists != 200806
|
|
95 # error "__cpp_initializer_lists != 200806"
|
|
96 #endif
|
|
97
|
|
98 #ifndef __cpp_delegating_constructors
|
|
99 # error "__cpp_delegating_constructors"
|
|
100 #elif __cpp_delegating_constructors != 200604
|
|
101 # error "__cpp_delegating_constructors != 200604"
|
|
102 #endif
|
|
103
|
|
104 #ifndef __cpp_nsdmi
|
|
105 # error "__cpp_nsdmi"
|
|
106 #elif __cpp_nsdmi != 200809
|
|
107 # error "__cpp_nsdmi != 200809"
|
|
108 #endif
|
|
109
|
|
110 #ifndef __cpp_inheriting_constructors
|
|
111 # error "__cpp_inheriting_constructors"
|
|
112 #elif __cpp_inheriting_constructors!= 201511
|
|
113 # error "__cpp_inheriting_constructors != 201511"
|
|
114 #endif
|
|
115
|
|
116 #ifndef __cpp_ref_qualifiers
|
|
117 # error "__cpp_ref_qualifiers"
|
|
118 #elif __cpp_ref_qualifiers != 200710
|
|
119 # error "__cpp_ref_qualifiers != 200710"
|
|
120 #endif
|
|
121
|
|
122 #ifndef __cpp_alias_templates
|
|
123 # error "__cpp_alias_templates"
|
|
124 #elif __cpp_alias_templates != 200704
|
|
125 # error "__cpp_alias_templates != 200704"
|
|
126 #endif
|
|
127
|
|
128 #ifndef __cpp_threadsafe_static_init
|
|
129 # error "__cpp_threadsafe_static_init"
|
|
130 #elif __cpp_threadsafe_static_init != 200806
|
|
131 # error "__cpp_threadsafe_static_init != 200806"
|
|
132 #endif
|
|
133
|
|
134 // C++14 features allowed in C++11 in non-ANSI modes:
|
|
135
|
|
136 #ifndef __cpp_binary_literals
|
|
137 # error "__cpp_binary_literals"
|
|
138 #elif __cpp_binary_literals != 201304
|
|
139 # error "__cpp_binary_literals != 201304"
|
|
140 #endif
|
|
141
|
|
142 // GNU VLA support:
|
|
143
|
|
144 #ifndef __cpp_runtime_arrays
|
|
145 # error "__cpp_runtime_arrays"
|
|
146 #elif __cpp_runtime_arrays != 198712
|
|
147 # error "__cpp_runtime_arrays != 198712"
|
|
148 #endif
|
|
149
|
|
150 // C++11 attributes:
|
|
151
|
|
152 #ifdef __has_cpp_attribute
|
|
153 # if ! __has_cpp_attribute(noreturn)
|
|
154 # error "__has_cpp_attribute(noreturn)"
|
|
155 # elif __has_cpp_attribute(noreturn) != 200809
|
|
156 # error "__has_cpp_attribute(noreturn) != 200809"
|
|
157 # endif
|
|
158 #else
|
|
159 # error "__has_cpp_attribute"
|
|
160 #endif
|
|
161
|
|
162 #ifdef __has_cpp_attribute
|
|
163 // Attribute carries_dependency not in yet.
|
|
164 //# if ! __has_cpp_attribute(carries_dependency)
|
|
165 //# error "__has_cpp_attribute(carries_dependency)"
|
|
166 //# elif __has_cpp_attribute(carries_dependency) != 200809
|
|
167 //# error "__has_cpp_attribute(carries_dependency) != 200809"
|
|
168 //# endif
|
|
169 #else
|
|
170 # error "__has_cpp_attribute"
|
|
171 #endif
|
|
172
|
|
173 // C++14 attributes:
|
|
174
|
|
175 // Attribute [[deprecated]] is allowed in C++11 as an extension.
|
|
176 #ifdef __has_cpp_attribute
|
|
177 # if ! __has_cpp_attribute(deprecated)
|
|
178 # error "__has_cpp_attribute(deprecated)"
|
|
179 # elif __has_cpp_attribute(deprecated) != 201309
|
|
180 # error "__has_cpp_attribute(deprecated) != 201309"
|
|
181 # endif
|
|
182 #else
|
|
183 # error "__has_cpp_attribute"
|
|
184 #endif
|