public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jason Merrill <jason@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-7279] Revert "c++: *this folding in constexpr call"
Date: Tue,  2 May 2023 20:26:01 +0000 (GMT)	[thread overview]
Message-ID: <20230502202601.6778D3882040@sourceware.org> (raw)

https://gcc.gnu.org/g:275e059dd7542f0d45adba74de18296134ac0d15

commit r13-7279-g275e059dd7542f0d45adba74de18296134ac0d15
Author: Jason Merrill <jason@redhat.com>
Date:   Tue May 2 15:03:57 2023 -0400

    Revert "c++: *this folding in constexpr call"
    
    The earlier commit wasn't fixing a known bug, so let's revert it on the
    branch.
    
            PR c++/109678
    
    This reverts commit 1189c03859cefef4fc4fd44d57eb3d4d3348b562.

Diff:
---
 gcc/cp/constexpr.cc | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index d1097764b10..56329dcc9e0 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -1440,8 +1440,6 @@ enum value_cat {
 
 static tree cxx_eval_constant_expression (const constexpr_ctx *, tree,
 					  value_cat, bool *, bool *, tree * = NULL);
-static tree cxx_fold_indirect_ref (const constexpr_ctx *, location_t, tree, tree,
-				   bool * = NULL);
 static tree find_heap_var_refs (tree *, int *, void *);
 
 /* Attempt to evaluate T which represents a call to a builtin function.
@@ -2956,7 +2954,9 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
 	 At this point it has already been evaluated in the call
 	 to cxx_bind_parameters_in_call.  */
       new_obj = TREE_VEC_ELT (new_call.bindings, 0);
-      new_obj = cxx_fold_indirect_ref (ctx, loc, DECL_CONTEXT (fun), new_obj);
+      STRIP_NOPS (new_obj);
+      if (TREE_CODE (new_obj) == ADDR_EXPR)
+	new_obj = TREE_OPERAND (new_obj, 0);
 
       if (ctx->call && ctx->call->fundef
 	  && DECL_CONSTRUCTOR_P (ctx->call->fundef->decl))
@@ -5474,8 +5474,7 @@ cxx_fold_indirect_ref_1 (const constexpr_ctx *ctx, location_t loc, tree type,
 	  && CLASS_TYPE_P (optype)
 	  && DERIVED_FROM_P (type, optype))
 	{
-	  if (empty_base)
-	    *empty_base = true;
+	  *empty_base = true;
 	  return op;
 	}
     }
@@ -5494,7 +5493,7 @@ cxx_fold_indirect_ref_1 (const constexpr_ctx *ctx, location_t loc, tree type,
 
 static tree
 cxx_fold_indirect_ref (const constexpr_ctx *ctx, location_t loc, tree type,
-		       tree op0, bool *empty_base /* = NULL*/)
+		       tree op0, bool *empty_base)
 {
   tree sub = op0;
   tree subtype;

                 reply	other threads:[~2023-05-02 20:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230502202601.6778D3882040@sourceware.org \
    --to=jason@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).