[Bug libstdc++/121180] std::any allows for creating multiple empty objects of the same type at the same address
tkaminsk at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Dec 9 08:23:11 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121180
--- Comment #9 from Tomasz Kamiński <tkaminsk at gcc dot gnu.org> ---
> So it would make sense for std::any to avoid creating objects in itself when this issue can arise.
The situation when such issue can arise is dynamic condition, so this will
entail disabling small object optimization entirely. I think the issue is an
defect in the standard, as the standard is meant to allow SSO, and thus stored
object to be nested withing any.
More information about the Gcc-bugs
mailing list