[Bug c++/107161] gcc doesn't constant fold member if any other member is mutable
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Oct 6 10:46:09 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107161
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC relies on 'p' being in .rodata for the folding which of course cannot be
the case with a mutable member. Note the frontend clears the 'const' from the
declaration because of the mutable member and we have no way to distinguish
constant from non-constant members here.
Do constexpr/consteval work in such circumstances?
More information about the Gcc-bugs
mailing list