https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70353
Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ppalka at gcc dot gnu.org --- Comment #10 from Patrick Palka <ppalka at gcc dot gnu.org> --- It's a hack, but we could pull the STRING_CST out from the artificial VAR_DECL during constexpr evaluation to avoid referring to __func__'s symbol. --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -3354,6 +3354,11 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t, case VAR_DECL: case CONST_DECL: + if (VAR_P (t) + && DECL_ARTIFICIAL (t) + && TREE_STATIC (t) + && TREE_CODE (DECL_INITIAL (t)) == STRING_CST) + return DECL_INITIAL (t); /* We used to not check lval for CONST_DECL, but darwin.c uses CONST_DECL for aggregate constants. */ if (lval)