aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2020-01-08 15:31:16 -0500
committerJason Merrill <jason@gcc.gnu.org>2020-01-08 15:31:16 -0500
commitcd3ca6cb1129b1e80b5b048a59aa3a0c387c2413 (patch)
tree1e603d55f8cd52f0c7a5878df141773ba2efd913
parent5b18be0b2bfcd9050bce5c456de377f73ee1f314 (diff)
downloadgcc-cd3ca6cb1129b1e80b5b048a59aa3a0c387c2413.zip
gcc-cd3ca6cb1129b1e80b5b048a59aa3a0c387c2413.tar.gz
gcc-cd3ca6cb1129b1e80b5b048a59aa3a0c387c2413.tar.bz2
Remove constexpr support for DECL_BY_REFERENCE.
Since we switched to doing constexpr evaluation on pre-GENERIC trees, we don't have to handle DECL_BY_REFERENCE. * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE support. From-SVN: r280017
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/constexpr.c17
2 files changed, 8 insertions, 14 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1655caf..c650fde 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-08 Jason Merrill <jason@redhat.com>
+
+ * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE
+ support.
+
2020-01-07 Paolo Carlini <paolo.carlini@oracle.com>
* init.c (build_new): Add location_t parameter and use it throughout.
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 417af18..806d3ab 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -2333,17 +2333,8 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
remapped = DECL_CHAIN (remapped);
}
/* Add the RESULT_DECL to the values map, too. */
- tree slot = NULL_TREE;
- if (DECL_BY_REFERENCE (res))
- {
- slot = AGGR_INIT_EXPR_SLOT (t);
- tree addr = build_address (slot);
- addr = build_nop (TREE_TYPE (res), addr);
- ctx->global->values.put (res, addr);
- ctx->global->values.put (slot, NULL_TREE);
- }
- else
- ctx->global->values.put (res, NULL_TREE);
+ gcc_assert (!DECL_BY_REFERENCE (res));
+ ctx->global->values.put (res, NULL_TREE);
/* Track the callee's evaluated SAVE_EXPRs and TARGET_EXPRs so that
we can forget their values after the call. */
@@ -2370,7 +2361,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
result = void_node;
else
{
- result = *ctx->global->values.get (slot ? slot : res);
+ result = *ctx->global->values.get (res);
if (result == NULL_TREE && !*non_constant_p)
{
if (!ctx->quiet)
@@ -2409,8 +2400,6 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
one constexpr evaluation? If so, maybe also clear out
other vars from call, maybe in BIND_EXPR handling? */
ctx->global->values.remove (res);
- if (slot)
- ctx->global->values.remove (slot);
for (tree parm = parms; parm; parm = TREE_CHAIN (parm))
ctx->global->values.remove (parm);