PR c++/64727
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 23 Jan 2015 14:59:10 +0000 (14:59 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 23 Jan 2015 14:59:10 +0000 (14:59 +0000)
* constexpr.c (cxx_eval_constant_expression): Allow for lvalue use
of CONST_DECL.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220041 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/constexpr.c

index 6e3a2e5..b1d4965 100644 (file)
@@ -1,3 +1,9 @@
+2015-01-23  Jason Merrill  <jason@redhat.com>
+
+       PR c++/64727
+       * constexpr.c (cxx_eval_constant_expression): Allow for lvalue use
+       of CONST_DECL.
+
 2015-01-21  Jason Merrill  <jason@redhat.com>
 
        PR c++/64603
index 7853d37..f144ab0 100644 (file)
@@ -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