132 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9// WARNING: This test was generated by generate_feature_test_macro_components.py10// and should not be edited manually.11 12// <variant>13 14// Test the feature test macros defined by <variant>15 16// clang-format off17 18#include <variant>19#include "test_macros.h"20 21#if TEST_STD_VER < 1422 23# ifdef __cpp_lib_constrained_equality24# error "__cpp_lib_constrained_equality should not be defined before c++26"25# endif26 27# ifdef __cpp_lib_freestanding_variant28# error "__cpp_lib_freestanding_variant should not be defined before c++26"29# endif30 31# ifdef __cpp_lib_variant32# error "__cpp_lib_variant should not be defined before c++17"33# endif34 35#elif TEST_STD_VER == 1436 37# ifdef __cpp_lib_constrained_equality38# error "__cpp_lib_constrained_equality should not be defined before c++26"39# endif40 41# ifdef __cpp_lib_freestanding_variant42# error "__cpp_lib_freestanding_variant should not be defined before c++26"43# endif44 45# ifdef __cpp_lib_variant46# error "__cpp_lib_variant should not be defined before c++17"47# endif48 49#elif TEST_STD_VER == 1750 51# ifdef __cpp_lib_constrained_equality52# error "__cpp_lib_constrained_equality should not be defined before c++26"53# endif54 55# ifdef __cpp_lib_freestanding_variant56# error "__cpp_lib_freestanding_variant should not be defined before c++26"57# endif58 59# ifndef __cpp_lib_variant60# error "__cpp_lib_variant should be defined in c++17"61# endif62# if __cpp_lib_variant != 202102L63# error "__cpp_lib_variant should have the value 202102L in c++17"64# endif65 66#elif TEST_STD_VER == 2067 68# ifdef __cpp_lib_constrained_equality69# error "__cpp_lib_constrained_equality should not be defined before c++26"70# endif71 72# ifdef __cpp_lib_freestanding_variant73# error "__cpp_lib_freestanding_variant should not be defined before c++26"74# endif75 76# ifndef __cpp_lib_variant77# error "__cpp_lib_variant should be defined in c++20"78# endif79# if __cpp_lib_variant != 202106L80# error "__cpp_lib_variant should have the value 202106L in c++20"81# endif82 83#elif TEST_STD_VER == 2384 85# ifdef __cpp_lib_constrained_equality86# error "__cpp_lib_constrained_equality should not be defined before c++26"87# endif88 89# ifdef __cpp_lib_freestanding_variant90# error "__cpp_lib_freestanding_variant should not be defined before c++26"91# endif92 93# ifndef __cpp_lib_variant94# error "__cpp_lib_variant should be defined in c++23"95# endif96# if __cpp_lib_variant != 202106L97# error "__cpp_lib_variant should have the value 202106L in c++23"98# endif99 100#elif TEST_STD_VER > 23101 102# ifndef __cpp_lib_constrained_equality103# error "__cpp_lib_constrained_equality should be defined in c++26"104# endif105# if __cpp_lib_constrained_equality != 202411L106# error "__cpp_lib_constrained_equality should have the value 202411L in c++26"107# endif108 109# if !defined(_LIBCPP_VERSION)110# ifndef __cpp_lib_freestanding_variant111# error "__cpp_lib_freestanding_variant should be defined in c++26"112# endif113# if __cpp_lib_freestanding_variant != 202311L114# error "__cpp_lib_freestanding_variant should have the value 202311L in c++26"115# endif116# else117# ifdef __cpp_lib_freestanding_variant118# error "__cpp_lib_freestanding_variant should not be defined because it is unimplemented in libc++!"119# endif120# endif121 122# ifndef __cpp_lib_variant123# error "__cpp_lib_variant should be defined in c++26"124# endif125# if __cpp_lib_variant != 202306L126# error "__cpp_lib_variant should have the value 202306L in c++26"127# endif128 129#endif // TEST_STD_VER > 23130 131// clang-format on132