https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121068
--- Comment #10 from Tomasz KamiĆski <tkaminsk at gcc dot gnu.org> --- If the object pointed by __location is not transparently replaceable, for example if I would create an object inside std::byte array that is an member, then does std::launder(__location) produce pointer to new object? __location does not automatically point there per (https://eel.is/c++draft/basic.life#10), by we meet precondition for launder (https://eel.is/c++draft/ptr.launder#2). This cannot happen for compile-time evaluation, as calling construct_at such way would require equivalent of reinterpret_cast, so we could do, but I am not sure if that is necessary. +#if __cpp_lib_launder + if consteval + { + return std::launder(__location); + } + else + { + return std::launder(static_cast<_Tp*>(__loc)); + } +#else + return static_cast<_Tp*>(__loc); +#endif