blob: e047ec3dfb13bfe9e52fe9dba65fa954d43ff7fb [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
JF Bastiene3c13a82016-03-22 21:12:48 +00004// RUN: %clang_cc1 -std=c++14 -fsized-deallocation -verify %s
5// RUN: %clang_cc1 -std=c++1z -fsized-deallocation -verify %s
6// RUN: %clang_cc1 -std=c++1z -fsized-deallocation -fconcepts-ts -DCONCEPTS_TS=1 -verify %s
Richard Smith3fa73f32015-10-22 04:27:47 +00007// RUN: %clang_cc1 -fcoroutines -DCOROUTINES -verify %s
Richard Smith91e474f2013-11-27 22:58:16 +00008
9// expected-no-diagnostics
10
Nico Weberb2348f42016-01-19 15:15:31 +000011// FIXME using `defined` in a macro has undefined behavior.
Richard Smith91e474f2013-11-27 22:58:16 +000012#if __cplusplus < 201103L
JF Bastiene3c13a82016-03-22 21:12:48 +000013#define check(macro, cxx98, cxx11, cxx14, cxx1z) cxx98 == 0 ? defined(__cpp_##macro) : __cpp_##macro != cxx98
14#elif __cplusplus < 201402L
15#define check(macro, cxx98, cxx11, cxx14, cxx1z) cxx11 == 0 ? defined(__cpp_##macro) : __cpp_##macro != cxx11
16#elif __cplusplus < 201406L
17#define check(macro, cxx98, cxx11, cxx14, cxx1z) cxx14 == 0 ? defined(__cpp_##macro) : __cpp_##macro != cxx14
Richard Smith91e474f2013-11-27 22:58:16 +000018#else
JF Bastiene3c13a82016-03-22 21:12:48 +000019#define check(macro, cxx98, cxx11, cxx14, cxx1z) cxx1z == 0 ? defined(__cpp_##macro) : __cpp_##macro != cxx1z
Richard Smith91e474f2013-11-27 22:58:16 +000020#endif
21
JF Bastiene3c13a82016-03-22 21:12:48 +000022#if check(binary_literals, 0, 0, 201304, 201304)
Richard Smith91e474f2013-11-27 22:58:16 +000023#error "wrong value for __cpp_binary_literals"
24#endif
25
JF Bastiene3c13a82016-03-22 21:12:48 +000026#if check(digit_separators, 0, 0, 201309, 201309)
Richard Smith38af8562014-11-12 21:16:38 +000027#error "wrong value for __cpp_digit_separators"
28#endif
29
JF Bastiene3c13a82016-03-22 21:12:48 +000030#if check(init_captures, 0, 0, 201304, 201304)
Richard Smith91e474f2013-11-27 22:58:16 +000031#error "wrong value for __cpp_init_captures"
32#endif
33
JF Bastiene3c13a82016-03-22 21:12:48 +000034#if check(generic_lambdas, 0, 0, 201304, 201304)
Richard Smith91e474f2013-11-27 22:58:16 +000035#error "wrong value for __cpp_generic_lambdas"
36#endif
37
JF Bastiene3c13a82016-03-22 21:12:48 +000038#if check(sized_deallocation, 0, 0, 201309, 201309)
Richard Smith38af8562014-11-12 21:16:38 +000039#error "wrong value for __cpp_sized_deallocation"
40#endif
41
JF Bastiene3c13a82016-03-22 21:12:48 +000042#if check(constexpr, 0, 200704, 201304, 201304)
Richard Smith91e474f2013-11-27 22:58:16 +000043#error "wrong value for __cpp_constexpr"
44#endif
45
JF Bastiene3c13a82016-03-22 21:12:48 +000046#if check(decltype_auto, 0, 0, 201304, 201304)
Richard Smith91e474f2013-11-27 22:58:16 +000047#error "wrong value for __cpp_decltype_auto"
48#endif
49
JF Bastiene3c13a82016-03-22 21:12:48 +000050#if check(return_type_deduction, 0, 0, 201304, 201304)
Richard Smith91e474f2013-11-27 22:58:16 +000051#error "wrong value for __cpp_return_type_deduction"
52#endif
53
JF Bastiene3c13a82016-03-22 21:12:48 +000054#if check(runtime_arrays, 0, 0, 0, 0)
Richard Smith91e474f2013-11-27 22:58:16 +000055#error "wrong value for __cpp_runtime_arrays"
56#endif
57
JF Bastiene3c13a82016-03-22 21:12:48 +000058#if check(aggregate_nsdmi, 0, 0, 201304, 201304)
Richard Smith91e474f2013-11-27 22:58:16 +000059#error "wrong value for __cpp_aggregate_nsdmi"
60#endif
61
JF Bastiene3c13a82016-03-22 21:12:48 +000062#if check(variable_templates, 0, 0, 201304, 201304)
Richard Smith91e474f2013-11-27 22:58:16 +000063#error "wrong value for __cpp_variable_templates"
64#endif
65
JF Bastiene3c13a82016-03-22 21:12:48 +000066#if check(unicode_characters, 0, 200704, 200704, 200704)
Richard Smith91e474f2013-11-27 22:58:16 +000067#error "wrong value for __cpp_unicode_characters"
68#endif
69
JF Bastiene3c13a82016-03-22 21:12:48 +000070#if check(raw_strings, 0, 200710, 200710, 200710)
Richard Smith91e474f2013-11-27 22:58:16 +000071#error "wrong value for __cpp_raw_strings"
72#endif
73
JF Bastiene3c13a82016-03-22 21:12:48 +000074#if check(unicode_literals, 0, 200710, 200710, 200710)
Richard Smith91e474f2013-11-27 22:58:16 +000075#error "wrong value for __cpp_unicode_literals"
76#endif
77
JF Bastiene3c13a82016-03-22 21:12:48 +000078#if check(user_defined_literals, 0, 200809, 200809, 200809)
Richard Smith91e474f2013-11-27 22:58:16 +000079#error "wrong value for __cpp_user_defined_literals"
80#endif
81
JF Bastiene3c13a82016-03-22 21:12:48 +000082#if check(lambdas, 0, 200907, 200907, 200907)
Richard Smith91e474f2013-11-27 22:58:16 +000083#error "wrong value for __cpp_lambdas"
84#endif
85
JF Bastiene3c13a82016-03-22 21:12:48 +000086#if check(range_based_for, 0, 200907, 200907, 200907)
Richard Smith38af8562014-11-12 21:16:38 +000087#error "wrong value for __cpp_range_based_for"
88#endif
89
JF Bastiene3c13a82016-03-22 21:12:48 +000090#if check(static_assert, 0, 200410, 200410, 200410)
Richard Smith91e474f2013-11-27 22:58:16 +000091#error "wrong value for __cpp_static_assert"
92#endif
93
JF Bastiene3c13a82016-03-22 21:12:48 +000094#if check(decltype, 0, 200707, 200707, 200707)
Richard Smith91e474f2013-11-27 22:58:16 +000095#error "wrong value for __cpp_decltype"
96#endif
97
JF Bastiene3c13a82016-03-22 21:12:48 +000098#if check(attributes, 0, 200809, 200809, 200809)
Richard Smith91e474f2013-11-27 22:58:16 +000099#error "wrong value for __cpp_attributes"
100#endif
101
JF Bastiene3c13a82016-03-22 21:12:48 +0000102#if check(rvalue_references, 0, 200610, 200610, 200610)
Richard Smith91e474f2013-11-27 22:58:16 +0000103#error "wrong value for __cpp_rvalue_references"
104#endif
105
JF Bastiene3c13a82016-03-22 21:12:48 +0000106#if check(variadic_templates, 0, 200704, 200704, 200704)
Richard Smith91e474f2013-11-27 22:58:16 +0000107#error "wrong value for __cpp_variadic_templates"
108#endif
Richard Smith38af8562014-11-12 21:16:38 +0000109
JF Bastiene3c13a82016-03-22 21:12:48 +0000110#if check(initializer_lists, 0, 200806, 200806, 200806)
Richard Smith38af8562014-11-12 21:16:38 +0000111#error "wrong value for __cpp_initializer_lists"
112#endif
113
JF Bastiene3c13a82016-03-22 21:12:48 +0000114#if check(delegating_constructors, 0, 200604, 200604, 200604)
Richard Smith38af8562014-11-12 21:16:38 +0000115#error "wrong value for __cpp_delegating_constructors"
116#endif
117
JF Bastiene3c13a82016-03-22 21:12:48 +0000118#if check(nsdmi, 0, 200809, 200809, 200809)
Richard Smith38af8562014-11-12 21:16:38 +0000119#error "wrong value for __cpp_nsdmi"
120#endif
121
JF Bastiene3c13a82016-03-22 21:12:48 +0000122#if check(inheriting_constructors, 0, 200802, 200802, 200802)
Richard Smith38af8562014-11-12 21:16:38 +0000123#error "wrong value for __cpp_inheriting_constructors"
124#endif
125
JF Bastiene3c13a82016-03-22 21:12:48 +0000126#if check(ref_qualifiers, 0, 200710, 200710, 200710)
Richard Smith38af8562014-11-12 21:16:38 +0000127#error "wrong value for __cpp_ref_qualifiers"
128#endif
129
JF Bastiene3c13a82016-03-22 21:12:48 +0000130#if check(alias_templates, 0, 200704, 200704, 200704)
Richard Smith38af8562014-11-12 21:16:38 +0000131#error "wrong value for __cpp_alias_templates"
132#endif
Faisal Vali24d59d12015-05-22 01:11:10 +0000133
JF Bastiene3c13a82016-03-22 21:12:48 +0000134#if check(experimental_concepts, 0, 0, CONCEPTS_TS, CONCEPTS_TS)
Faisal Vali24d59d12015-05-22 01:11:10 +0000135#error "wrong value for __cpp_experimental_concepts"
136#endif
Richard Smith3fa73f32015-10-22 04:27:47 +0000137
138#if (COROUTINES && !__cpp_coroutines) || (!COROUTINES && __cpp_coroutines)
139#error "wrong value for __cpp_coroutines"
140#endif