diff --git a/libcxx/include/version b/libcxx/include/version --- a/libcxx/include/version +++ b/libcxx/include/version @@ -252,7 +252,9 @@ # define __cpp_lib_char8_t 201811L # endif // # define __cpp_lib_concepts 201806L -# define __cpp_lib_constexpr_dynamic_alloc 201907L +# if defined(__cpp_constexpr_dynamic_alloc) +# define __cpp_lib_constexpr_dynamic_alloc 201907L +# endif # define __cpp_lib_constexpr_functional 201907L # define __cpp_lib_constexpr_numeric 201911L // # define __cpp_lib_constexpr_swap_algorithms 201806L diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.pass.cpp --- a/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.pass.cpp @@ -220,11 +220,17 @@ # endif # endif -# ifndef __cpp_lib_constexpr_dynamic_alloc -# error "__cpp_lib_constexpr_dynamic_alloc should be defined in c++20" -# endif -# if __cpp_lib_constexpr_dynamic_alloc != 201907L -# error "__cpp_lib_constexpr_dynamic_alloc should have the value 201907L in c++20" +# if defined(__cpp_constexpr_dynamic_alloc) +# ifndef __cpp_lib_constexpr_dynamic_alloc +# error "__cpp_lib_constexpr_dynamic_alloc should be defined in c++20" +# endif +# if __cpp_lib_constexpr_dynamic_alloc != 201907L +# error "__cpp_lib_constexpr_dynamic_alloc should have the value 201907L in c++20" +# endif +# else +# ifdef __cpp_lib_constexpr_dynamic_alloc +# error "__cpp_lib_constexpr_dynamic_alloc should not be defined when defined(__cpp_constexpr_dynamic_alloc) is not defined!" +# endif # endif # ifndef __cpp_lib_enable_shared_from_this 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 @@ -1897,11 +1897,17 @@ # endif # endif -# ifndef __cpp_lib_constexpr_dynamic_alloc -# error "__cpp_lib_constexpr_dynamic_alloc should be defined in c++20" -# endif -# if __cpp_lib_constexpr_dynamic_alloc != 201907L -# error "__cpp_lib_constexpr_dynamic_alloc should have the value 201907L in c++20" +# if defined(__cpp_constexpr_dynamic_alloc) +# ifndef __cpp_lib_constexpr_dynamic_alloc +# error "__cpp_lib_constexpr_dynamic_alloc should be defined in c++20" +# endif +# if __cpp_lib_constexpr_dynamic_alloc != 201907L +# error "__cpp_lib_constexpr_dynamic_alloc should have the value 201907L in c++20" +# endif +# else +# ifdef __cpp_lib_constexpr_dynamic_alloc +# error "__cpp_lib_constexpr_dynamic_alloc should not be defined when defined(__cpp_constexpr_dynamic_alloc) is not defined!" +# endif # endif # ifndef __cpp_lib_constexpr_functional diff --git a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp --- a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp +++ b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp @@ -6,6 +6,9 @@ // //===----------------------------------------------------------------------===// +// constexpr bool test() results in "error: constexpr function never produces a +// constant expression" before clang 11 +// UNSUPPORTED: clang-5, clang-6, clang-7, clang-8, clang-9, clang-10 // UNSUPPORTED: gcc-8, gcc-9 // diff --git a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp --- a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp +++ b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp @@ -6,7 +6,9 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: clang-8 +// constexpr bool test() results in "error: constexpr function never produces a +// constant expression" before clang 11 +// UNSUPPORTED: clang-5, clang-6, clang-7, clang-8, clang-9, clang-10 // UNSUPPORTED: gcc-8, gcc-9 // diff --git a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp --- a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp +++ b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp @@ -6,7 +6,8 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: clang-8 +// constexpr destructors are only supported starting with clang 10 +// UNSUPPORTED: clang-5, clang-6, clang-7, clang-8, clang-9 // constexpr destructors are only supported starting with gcc 10 // UNSUPPORTED: gcc-8, gcc-9 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 @@ -1,7 +1,6 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os -from builtins import range from functools import reduce def get_libcxx_paths(): @@ -160,6 +159,8 @@ "unimplemented": True, }, { "name": "__cpp_lib_constexpr_dynamic_alloc", + "depends": "defined(__cpp_constexpr_dynamic_alloc)", + "internal_depends": "defined(__cpp_constexpr_dynamic_alloc)", "values": { "c++20": 201907 }, "headers": ["memory"], }, {