xref: /minix3/external/bsd/llvm/dist/clang/test/Lexer/cxx-features.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -std=c++98 -verify %s
2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -std=c++11 -verify %s
3*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -std=c++1y -verify %s
4*0a6a1f1dSLionel Sambuc 
5*0a6a1f1dSLionel Sambuc // expected-no-diagnostics
6*0a6a1f1dSLionel Sambuc 
7*0a6a1f1dSLionel Sambuc #if __cplusplus < 201103L
8*0a6a1f1dSLionel Sambuc #define check(macro, cxx98, cxx11, cxx1y) cxx98 == 0 ? defined(__cpp_##macro) : __cpp_##macro != cxx98
9*0a6a1f1dSLionel Sambuc #elif __cplusplus < 201304L
10*0a6a1f1dSLionel Sambuc #define check(macro, cxx98, cxx11, cxx1y) cxx11 == 0 ? defined(__cpp_##macro) : __cpp_##macro != cxx11
11*0a6a1f1dSLionel Sambuc #else
12*0a6a1f1dSLionel Sambuc #define check(macro, cxx98, cxx11, cxx1y) cxx1y == 0 ? defined(__cpp_##macro) : __cpp_##macro != cxx1y
13*0a6a1f1dSLionel Sambuc #endif
14*0a6a1f1dSLionel Sambuc 
15*0a6a1f1dSLionel Sambuc #if check(binary_literals, 0, 0, 201304)
16*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_binary_literals"
17*0a6a1f1dSLionel Sambuc #endif
18*0a6a1f1dSLionel Sambuc 
19*0a6a1f1dSLionel Sambuc #if check(digit_separators, 0, 0, 201309)
20*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_digit_separators"
21*0a6a1f1dSLionel Sambuc #endif
22*0a6a1f1dSLionel Sambuc 
23*0a6a1f1dSLionel Sambuc #if check(init_captures, 0, 0, 201304)
24*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_init_captures"
25*0a6a1f1dSLionel Sambuc #endif
26*0a6a1f1dSLionel Sambuc 
27*0a6a1f1dSLionel Sambuc #if check(generic_lambdas, 0, 0, 201304)
28*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_generic_lambdas"
29*0a6a1f1dSLionel Sambuc #endif
30*0a6a1f1dSLionel Sambuc 
31*0a6a1f1dSLionel Sambuc #if check(sized_deallocation, 0, 0, 201309)
32*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_sized_deallocation"
33*0a6a1f1dSLionel Sambuc #endif
34*0a6a1f1dSLionel Sambuc 
35*0a6a1f1dSLionel Sambuc #if check(constexpr, 0, 200704, 201304)
36*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_constexpr"
37*0a6a1f1dSLionel Sambuc #endif
38*0a6a1f1dSLionel Sambuc 
39*0a6a1f1dSLionel Sambuc #if check(decltype_auto, 0, 0, 201304)
40*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_decltype_auto"
41*0a6a1f1dSLionel Sambuc #endif
42*0a6a1f1dSLionel Sambuc 
43*0a6a1f1dSLionel Sambuc #if check(return_type_deduction, 0, 0, 201304)
44*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_return_type_deduction"
45*0a6a1f1dSLionel Sambuc #endif
46*0a6a1f1dSLionel Sambuc 
47*0a6a1f1dSLionel Sambuc #if check(runtime_arrays, 0, 0, 0)
48*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_runtime_arrays"
49*0a6a1f1dSLionel Sambuc #endif
50*0a6a1f1dSLionel Sambuc 
51*0a6a1f1dSLionel Sambuc #if check(aggregate_nsdmi, 0, 0, 201304)
52*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_aggregate_nsdmi"
53*0a6a1f1dSLionel Sambuc #endif
54*0a6a1f1dSLionel Sambuc 
55*0a6a1f1dSLionel Sambuc #if check(variable_templates, 0, 0, 201304)
56*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_variable_templates"
57*0a6a1f1dSLionel Sambuc #endif
58*0a6a1f1dSLionel Sambuc 
59*0a6a1f1dSLionel Sambuc #if check(unicode_characters, 0, 200704, 200704)
60*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_unicode_characters"
61*0a6a1f1dSLionel Sambuc #endif
62*0a6a1f1dSLionel Sambuc 
63*0a6a1f1dSLionel Sambuc #if check(raw_strings, 0, 200710, 200710)
64*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_raw_strings"
65*0a6a1f1dSLionel Sambuc #endif
66*0a6a1f1dSLionel Sambuc 
67*0a6a1f1dSLionel Sambuc #if check(unicode_literals, 0, 200710, 200710)
68*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_unicode_literals"
69*0a6a1f1dSLionel Sambuc #endif
70*0a6a1f1dSLionel Sambuc 
71*0a6a1f1dSLionel Sambuc #if check(user_defined_literals, 0, 200809, 200809)
72*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_user_defined_literals"
73*0a6a1f1dSLionel Sambuc #endif
74*0a6a1f1dSLionel Sambuc 
75*0a6a1f1dSLionel Sambuc #if check(lambdas, 0, 200907, 200907)
76*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_lambdas"
77*0a6a1f1dSLionel Sambuc #endif
78*0a6a1f1dSLionel Sambuc 
79*0a6a1f1dSLionel Sambuc #if check(range_based_for, 0, 200907, 200907)
80*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_range_based_for"
81*0a6a1f1dSLionel Sambuc #endif
82*0a6a1f1dSLionel Sambuc 
83*0a6a1f1dSLionel Sambuc #if check(static_assert, 0, 200410, 200410)
84*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_static_assert"
85*0a6a1f1dSLionel Sambuc #endif
86*0a6a1f1dSLionel Sambuc 
87*0a6a1f1dSLionel Sambuc #if check(decltype, 0, 200707, 200707)
88*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_decltype"
89*0a6a1f1dSLionel Sambuc #endif
90*0a6a1f1dSLionel Sambuc 
91*0a6a1f1dSLionel Sambuc #if check(attributes, 0, 200809, 200809)
92*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_attributes"
93*0a6a1f1dSLionel Sambuc #endif
94*0a6a1f1dSLionel Sambuc 
95*0a6a1f1dSLionel Sambuc #if check(rvalue_references, 0, 200610, 200610)
96*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_rvalue_references"
97*0a6a1f1dSLionel Sambuc #endif
98*0a6a1f1dSLionel Sambuc 
99*0a6a1f1dSLionel Sambuc #if check(variadic_templates, 0, 200704, 200704)
100*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_variadic_templates"
101*0a6a1f1dSLionel Sambuc #endif
102*0a6a1f1dSLionel Sambuc 
103*0a6a1f1dSLionel Sambuc #if check(initializer_lists, 0, 200806, 200806)
104*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_initializer_lists"
105*0a6a1f1dSLionel Sambuc #endif
106*0a6a1f1dSLionel Sambuc 
107*0a6a1f1dSLionel Sambuc #if check(delegating_constructors, 0, 200604, 200604)
108*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_delegating_constructors"
109*0a6a1f1dSLionel Sambuc #endif
110*0a6a1f1dSLionel Sambuc 
111*0a6a1f1dSLionel Sambuc #if check(nsdmi, 0, 200809, 200809)
112*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_nsdmi"
113*0a6a1f1dSLionel Sambuc #endif
114*0a6a1f1dSLionel Sambuc 
115*0a6a1f1dSLionel Sambuc #if check(inheriting_constructors, 0, 200802, 200802)
116*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_inheriting_constructors"
117*0a6a1f1dSLionel Sambuc #endif
118*0a6a1f1dSLionel Sambuc 
119*0a6a1f1dSLionel Sambuc #if check(ref_qualifiers, 0, 200710, 200710)
120*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_ref_qualifiers"
121*0a6a1f1dSLionel Sambuc #endif
122*0a6a1f1dSLionel Sambuc 
123*0a6a1f1dSLionel Sambuc #if check(alias_templates, 0, 200704, 200704)
124*0a6a1f1dSLionel Sambuc #error "wrong value for __cpp_alias_templates"
125*0a6a1f1dSLionel Sambuc #endif
126