blob: b0f382ec253d2781aaa1eda590841aa461cdb800 [file] [log] [blame]
Richard Smith91e474f2013-11-27 22:58:16 +00001// RUN: %clang_cc1 -std=c++98 -verify %s
2// RUN: %clang_cc1 -std=c++11 -verify %s
Reid Kleckner7ffc3fb2015-03-20 00:31:07 +00003// RUN: %clang_cc1 -std=c++1y -fsized-deallocation -verify %s
Faisal Vali24d59d12015-05-22 01:11:10 +00004// RUN: %clang_cc1 -std=c++1y -fsized-deallocation -fconcepts-ts -DCONCEPTS_TS=1 -verify %s
Richard Smith3fa73f32015-10-22 04:27:47 +00005// RUN: %clang_cc1 -fcoroutines -DCOROUTINES -verify %s
Richard Smith91e474f2013-11-27 22:58:16 +00006
7// expected-no-diagnostics
8
Nico Weberb2348f42016-01-19 15:15:31 +00009// FIXME using `defined` in a macro has undefined behavior.
Richard Smith91e474f2013-11-27 22:58:16 +000010#if __cplusplus < 201103L
11#define check(macro, cxx98, cxx11, cxx1y) cxx98 == 0 ? defined(__cpp_##macro) : __cpp_##macro != cxx98
12#elif __cplusplus < 201304L
13#define check(macro, cxx98, cxx11, cxx1y) cxx11 == 0 ? defined(__cpp_##macro) : __cpp_##macro != cxx11
14#else
15#define check(macro, cxx98, cxx11, cxx1y) cxx1y == 0 ? defined(__cpp_##macro) : __cpp_##macro != cxx1y
16#endif
17
18#if check(binary_literals, 0, 0, 201304)
19#error "wrong value for __cpp_binary_literals"
20#endif
21
Richard Smith38af8562014-11-12 21:16:38 +000022#if check(digit_separators, 0, 0, 201309)
23#error "wrong value for __cpp_digit_separators"
24#endif
25
Richard Smith91e474f2013-11-27 22:58:16 +000026#if check(init_captures, 0, 0, 201304)
27#error "wrong value for __cpp_init_captures"
28#endif
29
30#if check(generic_lambdas, 0, 0, 201304)
31#error "wrong value for __cpp_generic_lambdas"
32#endif
33
Richard Smith38af8562014-11-12 21:16:38 +000034#if check(sized_deallocation, 0, 0, 201309)
35#error "wrong value for __cpp_sized_deallocation"
36#endif
37
Richard Smith91e474f2013-11-27 22:58:16 +000038#if check(constexpr, 0, 200704, 201304)
39#error "wrong value for __cpp_constexpr"
40#endif
41
42#if check(decltype_auto, 0, 0, 201304)
43#error "wrong value for __cpp_decltype_auto"
44#endif
45
46#if check(return_type_deduction, 0, 0, 201304)
47#error "wrong value for __cpp_return_type_deduction"
48#endif
49
50#if check(runtime_arrays, 0, 0, 0)
51#error "wrong value for __cpp_runtime_arrays"
52#endif
53
54#if check(aggregate_nsdmi, 0, 0, 201304)
55#error "wrong value for __cpp_aggregate_nsdmi"
56#endif
57
58#if check(variable_templates, 0, 0, 201304)
59#error "wrong value for __cpp_variable_templates"
60#endif
61
62#if check(unicode_characters, 0, 200704, 200704)
63#error "wrong value for __cpp_unicode_characters"
64#endif
65
66#if check(raw_strings, 0, 200710, 200710)
67#error "wrong value for __cpp_raw_strings"
68#endif
69
70#if check(unicode_literals, 0, 200710, 200710)
71#error "wrong value for __cpp_unicode_literals"
72#endif
73
74#if check(user_defined_literals, 0, 200809, 200809)
75#error "wrong value for __cpp_user_defined_literals"
76#endif
77
78#if check(lambdas, 0, 200907, 200907)
79#error "wrong value for __cpp_lambdas"
80#endif
81
Richard Smith38af8562014-11-12 21:16:38 +000082#if check(range_based_for, 0, 200907, 200907)
83#error "wrong value for __cpp_range_based_for"
84#endif
85
Richard Smith91e474f2013-11-27 22:58:16 +000086#if check(static_assert, 0, 200410, 200410)
87#error "wrong value for __cpp_static_assert"
88#endif
89
90#if check(decltype, 0, 200707, 200707)
91#error "wrong value for __cpp_decltype"
92#endif
93
94#if check(attributes, 0, 200809, 200809)
95#error "wrong value for __cpp_attributes"
96#endif
97
98#if check(rvalue_references, 0, 200610, 200610)
99#error "wrong value for __cpp_rvalue_references"
100#endif
101
102#if check(variadic_templates, 0, 200704, 200704)
103#error "wrong value for __cpp_variadic_templates"
104#endif
Richard Smith38af8562014-11-12 21:16:38 +0000105
106#if check(initializer_lists, 0, 200806, 200806)
107#error "wrong value for __cpp_initializer_lists"
108#endif
109
110#if check(delegating_constructors, 0, 200604, 200604)
111#error "wrong value for __cpp_delegating_constructors"
112#endif
113
114#if check(nsdmi, 0, 200809, 200809)
115#error "wrong value for __cpp_nsdmi"
116#endif
117
118#if check(inheriting_constructors, 0, 200802, 200802)
119#error "wrong value for __cpp_inheriting_constructors"
120#endif
121
122#if check(ref_qualifiers, 0, 200710, 200710)
123#error "wrong value for __cpp_ref_qualifiers"
124#endif
125
126#if check(alias_templates, 0, 200704, 200704)
127#error "wrong value for __cpp_alias_templates"
128#endif
Faisal Vali24d59d12015-05-22 01:11:10 +0000129
130#if check(experimental_concepts, 0, 0, CONCEPTS_TS)
131#error "wrong value for __cpp_experimental_concepts"
132#endif
Richard Smith3fa73f32015-10-22 04:27:47 +0000133
134#if (COROUTINES && !__cpp_coroutines) || (!COROUTINES && __cpp_coroutines)
135#error "wrong value for __cpp_coroutines"
136#endif