https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97132
--- Comment #4 from fsb4000 at yandex dot ru ---
(In reply to Jonathan Wakely from comment #3)
> I'll test this:
>
> {
> static_assert(std::has_single_bit(_Align));
> _GLIBCXX_DEBUG_ASSERT((std::uintptr_t)__ptr % _Align == 0);
> - return static_cast<_Tp*>(__builtin_assume_aligned(__ptr, _Align));
> + if (std::is_constant_evaluated())
> + return __ptr;
> + else
> + return static_cast<_Tp*>(__builtin_assume_aligned(__ptr, _Align));
> }
> #endif // C++2a
Yes, should be fine.
We do same for Microsoft STL.