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