[Bug libstdc++/111351] constexpr std::string objects permitted to escape constant evaluation when SSO
foom at fuhm dot net
gcc-bugzilla@gcc.gnu.org
Tue Sep 12 21:43:21 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111351
--- Comment #5 from James Y Knight <foom at fuhm dot net> ---
> Does using __builtin_is_constant_p on the union member not work?
I've created a proof-of-concept patch for libc++ to support SSO strings during
constant evaluation. It works.
If everyone disagrees with me and believes that this is a really awesome
foot-gun to give to users, I will go ahead and propose that patch to libc++
maintainers. (As mentioned, that'll cause more code to be compilable under
libc++ than is possible to permit under libstdc++/MSVC implementations).
However, I continue to believe the opposite outcome, prohibiting this
everywhere, would be preferable.
More information about the Gcc-bugs
mailing list