aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-12-04 15:37:24 -0500
committerJason Merrill <jason@gcc.gnu.org>2014-12-04 15:37:24 -0500
commita1408b7e414610b8d7e2d3d6784746cff578178f (patch)
treec31054ac64e9362b5e679c8821fccad3ac4feb5a
parent6dc8211094a292f53016a95905bcdd7cd257cb71 (diff)
downloadgcc-a1408b7e414610b8d7e2d3d6784746cff578178f.zip
gcc-a1408b7e414610b8d7e2d3d6784746cff578178f.tar.gz
gcc-a1408b7e414610b8d7e2d3d6784746cff578178f.tar.bz2
re PR c++/64080 ([C++14]ICE in cxx_eval_store_expression)
PR c++/64080 * constexpr.c (cxx_eval_store_expression): Handle non-decl store targets. From-SVN: r218401
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/constexpr.c9
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/constexpr-ref1.C9
3 files changed, 21 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0e2548f..2db8bd7 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2014-12-03 Jason Merrill <jason@redhat.com>
+
+ PR c++/64080
+ * constexpr.c (cxx_eval_store_expression): Handle non-decl store
+ targets.
+
2014-12-03 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/63558
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index d18025f..9426d85 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -2583,19 +2583,22 @@ cxx_eval_store_expression (const constexpr_ctx *ctx, tree t,
default:
object = probe;
- gcc_assert (DECL_P (object));
}
}
/* And then find/build up our initializer for the path to the subobject
we're initializing. */
- tree *valp = ctx->values->get (object);
+ tree *valp;
+ if (DECL_P (object))
+ valp = ctx->values->get (object);
+ else
+ valp = NULL;
if (!valp)
{
/* A constant-expression cannot modify objects from outside the
constant-expression. */
if (!ctx->quiet)
- error ("modification of %qD is not a constant-expression", object);
+ error ("modification of %qE is not a constant-expression", object);
*non_constant_p = true;
return t;
}
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-ref1.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-ref1.C
new file mode 100644
index 0000000..6f88f82
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-ref1.C
@@ -0,0 +1,9 @@
+// PR c++/64080
+// { dg-do compile { target c++14 } }
+
+constexpr void foo (int&& i) { i = 0; }
+
+void bar(int&& i)
+{
+ bool b = noexcept(foo(static_cast<int&&>(i)));
+}