]> gcc.gnu.org Git - gcc.git/commitdiff
Add TARGET_EXPR_DIRECT_INIT_P sanity check.
authorJason Merrill <jason@redhat.com>
Wed, 8 Jan 2020 20:31:25 +0000 (15:31 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 8 Jan 2020 20:31:25 +0000 (15:31 -0500)
* cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check
TARGET_EXPR_DIRECT_INIT_P.
* constexpr.c (cxx_eval_constant_expression): Likewise.

From-SVN: r280019

gcc/cp/ChangeLog
gcc/cp/constexpr.c
gcc/cp/cp-gimplify.c

index 7aacbe2334b67e4083c9060c8a0e80d0fdd77734..210ab4e619f5a544962a02e84d0180dbdd05d346 100644 (file)
@@ -1,3 +1,9 @@
+2020-01-08  Jason Merrill  <jason@redhat.com>
+
+       * cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check
+       TARGET_EXPR_DIRECT_INIT_P.
+       * constexpr.c (cxx_eval_constant_expression): Likewise.
+
 2020-01-08  Jason Merrill  <jason@redhat.com>
 
        PR c++/91369 - constexpr destructor and member initializer.
index 5fe6d0277b6041ba54f4dcb858f5190342d21b56..9306a7dce4a1fd6642d283108e3594f55e643c5f 100644 (file)
@@ -5312,6 +5312,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
          *non_constant_p = true;
          break;
        }
+      gcc_checking_assert (!TARGET_EXPR_DIRECT_INIT_P (t));
       /* Avoid evaluating a TARGET_EXPR more than once.  */
       if (tree *p = ctx->global->values.get (TARGET_EXPR_SLOT (t)))
        {
index 1d2a77d2c0ad330f203768a3a3389d57dfaa4921..827d240d11ad87fbebd11313a9e3bbb358a784ae 100644 (file)
@@ -925,6 +925,13 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
        }
       break;
 
+    case TARGET_EXPR:
+      /* A TARGET_EXPR that expresses direct-initialization should have been
+        elided by cp_gimplify_init_expr.  */
+      gcc_checking_assert (!TARGET_EXPR_DIRECT_INIT_P (*expr_p));
+      ret = GS_UNHANDLED;
+      break;
+
     case RETURN_EXPR:
       if (TREE_OPERAND (*expr_p, 0)
          && (TREE_CODE (TREE_OPERAND (*expr_p, 0)) == INIT_EXPR
This page took 0.071316 seconds and 5 git commands to generate.