This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/70353] [5/6 regression] ICE on __PRETTY_FUNCTION__ in a constexpr function
- From: "ppalka at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 24 Mar 2016 13:13:02 +0000
- Subject: [Bug c++/70353] [5/6 regression] ICE on __PRETTY_FUNCTION__ in a constexpr function
- Auto-submitted: auto-generated
- References: <bug-70353-4 at http dot gcc dot gnu dot org/bugzilla/>
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)