[Bug c++/111284] [11/12/13/14 Regression] Some passing-by-value parameters are mishandled since GCC 9, affecting libstdc++'s constexpr std::string
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Mar 7 18:58:12 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111284
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 57648
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57648&action=edit
gcc14-pr111284.patch
So, I've tried to fix this by constexpr evaluating the arguments passed to
PARM_DECLs with TREE_ADDRESSABLE types in the caller as lvalues rather than
rvaluea and later, if we try to evaluate the PARM_DECL in the callee as lval,
lookup the value and use that, if it is rval constexpr evaluate again as
rvalue.
There is a complication for qualified type, say if the argument is const in the
callee and caller is passing reference to non-const, adjust_temp_type can't
handle that when it isn't a rvalue.
More information about the Gcc-bugs
mailing list