mirror of git://gcc.gnu.org/git/gcc.git
libstdc++: Add missing constexpr to __atomic_impl::__clear_padding
This is called from the std::atomic<floating-point-type> constructor, which needs to be usable in constant expressions. libstdc++-v3/ChangeLog: * include/bits/atomic_base.h (__atomic_impl::__clear_padding): Add missing constexpr specifier. * testsuite/29_atomics/atomic_float/constinit.cc: New test. Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
This commit is contained in:
parent
0bb1db32cc
commit
ae91b5dd14
|
@ -968,7 +968,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
_GLIBCXX_ALWAYS_INLINE _Tp*
|
_GLIBCXX_ALWAYS_INLINE _GLIBCXX14_CONSTEXPR _Tp*
|
||||||
__clear_padding(_Tp& __val) noexcept
|
__clear_padding(_Tp& __val) noexcept
|
||||||
{
|
{
|
||||||
auto* __ptr = std::__addressof(__val);
|
auto* __ptr = std::__addressof(__val);
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
// { dg-do compile { target c++20 } }
|
||||||
|
#include <atomic>
|
||||||
|
constinit std::atomic<float> a(0.0f);
|
Loading…
Reference in New Issue