From 7c83622c6b1c95cdeb12fa5e6b0ef294c78eff16 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 23 Jan 2015 09:59:10 -0500 Subject: [PATCH] re PR c++/64727 (g++.dg/torture/darwin-cfstring-3.C:11:80: internal compiler error: Segmentation fault: 11) PR c++/64727 * constexpr.c (cxx_eval_constant_expression): Allow for lvalue use of CONST_DECL. From-SVN: r220041 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/constexpr.c | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6e3a2e566fa..b1d4965cc39 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2015-01-23 Jason Merrill + + PR c++/64727 + * constexpr.c (cxx_eval_constant_expression): Allow for lvalue use + of CONST_DECL. + 2015-01-21 Jason Merrill PR c++/64603 diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 7853d377849..f144ab01d24 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -2955,10 +2955,11 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t, return (*ctx->values->get (t)); case VAR_DECL: + case CONST_DECL: + /* We used to not check lval for CONST_DECL, but darwin.c uses + CONST_DECL for aggregate constants. */ if (lval) return t; - /* else fall through. */ - case CONST_DECL: if (ctx->strict) r = decl_really_constant_value (t); else -- 2.30.2