diff --git a/libcxx/include/__config b/libcxx/include/__config --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -885,6 +885,12 @@ # define _LIBCPP_NODISCARD_AFTER_CXX17 # endif +# if _LIBCPP_STD_VER >= 17 +# define _LIBCPP_INLINE_CONSTEXPR_VAR inline constexpr +# else +# define _LIBCPP_INLINE_CONSTEXPR_VAR constexpr // This technically leads to ODR violations, but they are benign. +# endif + # if __has_attribute(__no_destroy__) # define _LIBCPP_NO_DESTROY __attribute__((__no_destroy__)) # else diff --git a/libcxx/include/__functional/bind.h b/libcxx/include/__functional/bind.h --- a/libcxx/include/__functional/bind.h +++ b/libcxx/include/__functional/bind.h @@ -64,16 +64,16 @@ _LIBCPP_FUNC_VIS extern const __ph<9> _9; _LIBCPP_FUNC_VIS extern const __ph<10> _10; #else -/* inline */ constexpr __ph<1> _1{}; -/* inline */ constexpr __ph<2> _2{}; -/* inline */ constexpr __ph<3> _3{}; -/* inline */ constexpr __ph<4> _4{}; -/* inline */ constexpr __ph<5> _5{}; -/* inline */ constexpr __ph<6> _6{}; -/* inline */ constexpr __ph<7> _7{}; -/* inline */ constexpr __ph<8> _8{}; -/* inline */ constexpr __ph<9> _9{}; -/* inline */ constexpr __ph<10> _10{}; +_LIBCPP_INLINE_CONSTEXPR_VAR __ph<1> _1{}; +_LIBCPP_INLINE_CONSTEXPR_VAR __ph<2> _2{}; +_LIBCPP_INLINE_CONSTEXPR_VAR __ph<3> _3{}; +_LIBCPP_INLINE_CONSTEXPR_VAR __ph<4> _4{}; +_LIBCPP_INLINE_CONSTEXPR_VAR __ph<5> _5{}; +_LIBCPP_INLINE_CONSTEXPR_VAR __ph<6> _6{}; +_LIBCPP_INLINE_CONSTEXPR_VAR __ph<7> _7{}; +_LIBCPP_INLINE_CONSTEXPR_VAR __ph<8> _8{}; +_LIBCPP_INLINE_CONSTEXPR_VAR __ph<9> _9{}; +_LIBCPP_INLINE_CONSTEXPR_VAR __ph<10> _10{}; #endif // defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY) } // namespace placeholders diff --git a/libcxx/include/__memory/allocator_arg_t.h b/libcxx/include/__memory/allocator_arg_t.h --- a/libcxx/include/__memory/allocator_arg_t.h +++ b/libcxx/include/__memory/allocator_arg_t.h @@ -28,7 +28,7 @@ #if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY) extern _LIBCPP_EXPORTED_FROM_ABI const allocator_arg_t allocator_arg; #else -/* inline */ constexpr allocator_arg_t allocator_arg = allocator_arg_t(); +_LIBCPP_INLINE_CONSTEXPR_VAR allocator_arg_t allocator_arg = allocator_arg_t(); #endif #ifndef _LIBCPP_CXX03_LANG diff --git a/libcxx/include/__mutex_base b/libcxx/include/__mutex_base --- a/libcxx/include/__mutex_base +++ b/libcxx/include/__mutex_base @@ -72,9 +72,9 @@ #else -/* inline */ constexpr defer_lock_t defer_lock = defer_lock_t(); -/* inline */ constexpr try_to_lock_t try_to_lock = try_to_lock_t(); -/* inline */ constexpr adopt_lock_t adopt_lock = adopt_lock_t(); +_LIBCPP_INLINE_CONSTEXPR_VAR defer_lock_t defer_lock = defer_lock_t(); +_LIBCPP_INLINE_CONSTEXPR_VAR try_to_lock_t try_to_lock = try_to_lock_t(); +_LIBCPP_INLINE_CONSTEXPR_VAR adopt_lock_t adopt_lock = adopt_lock_t(); #endif diff --git a/libcxx/include/__utility/piecewise_construct.h b/libcxx/include/__utility/piecewise_construct.h --- a/libcxx/include/__utility/piecewise_construct.h +++ b/libcxx/include/__utility/piecewise_construct.h @@ -21,7 +21,7 @@ #if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY) extern _LIBCPP_EXPORTED_FROM_ABI const piecewise_construct_t piecewise_construct;// = piecewise_construct_t(); #else -/* inline */ constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t(); +_LIBCPP_INLINE_CONSTEXPR_VAR piecewise_construct_t piecewise_construct = piecewise_construct_t(); #endif _LIBCPP_END_NAMESPACE_STD