diff --git a/libcxx/include/concepts b/libcxx/include/concepts --- a/libcxx/include/concepts +++ b/libcxx/include/concepts @@ -149,7 +149,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 && defined(__cpp_concepts) && __cpp_concepts >= 201811L +#if _LIBCPP_STD_VER > 17 && !_LIBCPP_HAS_NO_CONCEPTS // [concept.same] @@ -228,7 +228,7 @@ template concept regular_invocable = invocable<_Fn, _Args...>; -#endif // _LIBCPP_STD_VER > 17 && defined(__cpp_concepts) && __cpp_concepts >= 201811L +#endif // _LIBCPP_STD_VER > 17 && !_LIBCPP_HAS_NO_CONCEPTS _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/numbers b/libcxx/include/numbers --- a/libcxx/include/numbers +++ b/libcxx/include/numbers @@ -60,8 +60,9 @@ #include <__config> -#if _LIBCPP_STD_VER > 17 && defined(__cpp_concepts) && __cpp_concepts >= 201811L +#if _LIBCPP_STD_VER > 17 && !_LIBCPP_HAS_NO_CONCEPTS +#include #include #include @@ -99,22 +100,19 @@ template inline constexpr T egamma_v = __illformed{}; template inline constexpr T phi_v = __illformed{}; -template -concept __floating_point = is_floating_point_v; - -template <__floating_point T> inline constexpr T e_v = 2.718281828459045235360287471352662; -template <__floating_point T> inline constexpr T log2e_v = 1.442695040888963407359924681001892; -template <__floating_point T> inline constexpr T log10e_v = 0.434294481903251827651128918916605; -template <__floating_point T> inline constexpr T pi_v = 3.141592653589793238462643383279502; -template <__floating_point T> inline constexpr T inv_pi_v = 0.318309886183790671537767526745028; -template <__floating_point T> inline constexpr T inv_sqrtpi_v = 0.564189583547756286948079451560772; -template <__floating_point T> inline constexpr T ln2_v = 0.693147180559945309417232121458176; -template <__floating_point T> inline constexpr T ln10_v = 2.302585092994045684017991454684364; -template <__floating_point T> inline constexpr T sqrt2_v = 1.414213562373095048801688724209698; -template <__floating_point T> inline constexpr T sqrt3_v = 1.732050807568877293527446341505872; -template <__floating_point T> inline constexpr T inv_sqrt3_v = 0.577350269189625764509148780501957; -template <__floating_point T> inline constexpr T egamma_v = 0.577215664901532860606512090082402; -template <__floating_point T> inline constexpr T phi_v = 1.618033988749894848204586834365638; +template inline constexpr T e_v = 2.718281828459045235360287471352662; +template inline constexpr T log2e_v = 1.442695040888963407359924681001892; +template inline constexpr T log10e_v = 0.434294481903251827651128918916605; +template inline constexpr T pi_v = 3.141592653589793238462643383279502; +template inline constexpr T inv_pi_v = 0.318309886183790671537767526745028; +template inline constexpr T inv_sqrtpi_v = 0.564189583547756286948079451560772; +template inline constexpr T ln2_v = 0.693147180559945309417232121458176; +template inline constexpr T ln10_v = 2.302585092994045684017991454684364; +template inline constexpr T sqrt2_v = 1.414213562373095048801688724209698; +template inline constexpr T sqrt3_v = 1.732050807568877293527446341505872; +template inline constexpr T inv_sqrt3_v = 0.577350269189625764509148780501957; +template inline constexpr T egamma_v = 0.577215664901532860606512090082402; +template inline constexpr T phi_v = 1.618033988749894848204586834365638; inline constexpr double e = e_v; inline constexpr double log2e = log2e_v; @@ -136,6 +134,6 @@ _LIBCPP_POP_MACROS -#endif //_LIBCPP_STD_VER > 17 && defined(__cpp_concepts) && __cpp_concepts >= 201811L +#endif //_LIBCPP_STD_VER > 17 && !_LIBCPP_HAS_NO_CONCEPTS #endif // _LIBCPP_NUMBERS diff --git a/libcxx/include/random b/libcxx/include/random --- a/libcxx/include/random +++ b/libcxx/include/random @@ -1701,7 +1701,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 && defined(__cpp_concepts) && __cpp_concepts >= 201811L +#if _LIBCPP_STD_VER > 17 && !_LIBCPP_HAS_NO_CONCEPTS // [rand.req.urng] template @@ -1713,7 +1713,7 @@ requires bool_constant<(_Gen::min() < _Gen::max())>::value; }; -#endif // _LIBCPP_STD_VER > 17 && defined(__cpp_concepts) && __cpp_concepts >= 201811L +#endif // _LIBCPP_STD_VER > 17 && !_LIBCPP_HAS_NO_CONCEPTS // __is_seed_sequence diff --git a/libcxx/include/version b/libcxx/include/version --- a/libcxx/include/version +++ b/libcxx/include/version @@ -336,7 +336,7 @@ # define __cpp_lib_latch 201907L # endif # define __cpp_lib_list_remove_return_type 201806L -# if defined(__cpp_concepts) && __cpp_concepts >= 201811L +# if !_LIBCPP_HAS_NO_CONCEPTS # define __cpp_lib_math_constants 201907L # endif // # define __cpp_lib_polymorphic_allocator 201902L diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/numbers.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/numbers.version.pass.cpp --- a/libcxx/test/std/language.support/support.limits/support.limits.general/numbers.version.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/numbers.version.pass.cpp @@ -42,7 +42,7 @@ #elif TEST_STD_VER == 20 -# if defined(__cpp_concepts) && __cpp_concepts >= 201811L +# if !_LIBCPP_HAS_NO_CONCEPTS # ifndef __cpp_lib_math_constants # error "__cpp_lib_math_constants should be defined in c++20" # endif @@ -51,13 +51,13 @@ # endif # else # ifdef __cpp_lib_math_constants -# error "__cpp_lib_math_constants should not be defined when defined(__cpp_concepts) && __cpp_concepts >= 201811L is not defined!" +# error "__cpp_lib_math_constants should not be defined when defined(__cpp_concepts) && __cpp_concepts >= 201907L is not defined!" # endif # endif #elif TEST_STD_VER > 20 -# if defined(__cpp_concepts) && __cpp_concepts >= 201811L +# if !_LIBCPP_HAS_NO_CONCEPTS # ifndef __cpp_lib_math_constants # error "__cpp_lib_math_constants should be defined in c++2b" # endif @@ -66,7 +66,7 @@ # endif # else # ifdef __cpp_lib_math_constants -# error "__cpp_lib_math_constants should not be defined when defined(__cpp_concepts) && __cpp_concepts >= 201811L is not defined!" +# error "__cpp_lib_math_constants should not be defined when defined(__cpp_concepts) && __cpp_concepts >= 201907L is not defined!" # endif # endif diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp --- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp @@ -2883,7 +2883,7 @@ # error "__cpp_lib_map_try_emplace should have the value 201411L in c++20" # endif -# if defined(__cpp_concepts) && __cpp_concepts >= 201811L +# if !_LIBCPP_HAS_NO_CONCEPTS # ifndef __cpp_lib_math_constants # error "__cpp_lib_math_constants should be defined in c++20" # endif @@ -2892,9 +2892,9 @@ # endif # else # ifdef __cpp_lib_math_constants -# error "__cpp_lib_math_constants should not be defined when defined(__cpp_concepts) && __cpp_concepts >= 201811L is not defined!" +# error "__cpp_lib_math_constants should not be defined when defined(__cpp_concepts) && __cpp_concepts >= 201907L is not defined!" # endif -# endif +# endif // !_LIBCPP_HAS_NO_CONCEPTS # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_math_special_functions @@ -4099,7 +4099,7 @@ # error "__cpp_lib_map_try_emplace should have the value 201411L in c++2b" # endif -# if defined(__cpp_concepts) && __cpp_concepts >= 201811L +# if !_LIBCPP_HAS_NO_CONCEPTS # ifndef __cpp_lib_math_constants # error "__cpp_lib_math_constants should be defined in c++2b" # endif @@ -4108,9 +4108,9 @@ # endif # else # ifdef __cpp_lib_math_constants -# error "__cpp_lib_math_constants should not be defined when defined(__cpp_concepts) && __cpp_concepts >= 201811L is not defined!" +# error "__cpp_lib_math_constants should not be defined when defined(__cpp_concepts) && __cpp_concepts >= 201907L is not defined!" # endif -# endif +# endif // !_LIBCPP_HAS_NO_CONCEPTS # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_math_special_functions diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py --- a/libcxx/utils/generate_feature_test_macro_components.py +++ b/libcxx/utils/generate_feature_test_macro_components.py @@ -422,8 +422,8 @@ "name": "__cpp_lib_math_constants", "values": { "c++20": 201907 }, "headers": ["numbers"], - "depends": "defined(__cpp_concepts) && __cpp_concepts >= 201811L", - "internal_depends": "defined(__cpp_concepts) && __cpp_concepts >= 201811L", + "depends": "defined(__cpp_concepts) && __cpp_concepts >= 201907L", + "internal_depends": "defined(__cpp_concepts) && __cpp_concepts >= 201907L", }, { "name": "__cpp_lib_math_special_functions", "values": { "c++17": 201603 }, diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py --- a/libcxx/utils/libcxx/test/features.py +++ b/libcxx/utils/libcxx/test/features.py @@ -36,7 +36,7 @@ Feature(name='libcpp-no-if-constexpr', when=lambda cfg: '__cpp_if_constexpr' not in featureTestMacros(cfg)), Feature(name='libcpp-no-structured-bindings', when=lambda cfg: '__cpp_structured_bindings' not in featureTestMacros(cfg)), Feature(name='libcpp-no-deduction-guides', when=lambda cfg: featureTestMacros(cfg).get('__cpp_deduction_guides', 0) < 201611), - Feature(name='libcpp-no-concepts', when=lambda cfg: featureTestMacros(cfg).get('__cpp_concepts', 0) < 201811), + Feature(name='libcpp-no-concepts', when=lambda cfg: featureTestMacros(cfg).get('__cpp_concepts', 0) < 201907), Feature(name='has-fobjc-arc', when=lambda cfg: hasCompileFlag(cfg, '-xobjective-c++ -fobjc-arc') and sys.platform.lower().strip() == 'darwin'), # TODO: this doesn't handle cross-compiling to Apple platforms. Feature(name='objective-c++', when=lambda cfg: hasCompileFlag(cfg, '-xobjective-c++ -fobjc-arc')),