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>
}
template<typename _Tp>
- _GLIBCXX_ALWAYS_INLINE _Tp*
+ _GLIBCXX_ALWAYS_INLINE _GLIBCXX14_CONSTEXPR _Tp*
__clear_padding(_Tp& __val) noexcept
{
auto* __ptr = std::__addressof(__val);
--- /dev/null
+// { dg-do compile { target c++20 } }
+#include <atomic>
+constinit std::atomic<float> a(0.0f);