From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 0413D3857001 for ; Wed, 13 Dec 2023 16:47:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0413D3857001 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0413D3857001 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702486087; cv=none; b=A5joBkJpWx5edDbXZYbxoTAq8vQsoyqh5jOkyDDQ94pOc6+eEDtBd5g4Bq9yEiozelr2npuPciyy+QOUrIjwiheD6otEhnTm7OnupCvFhN1cSPuDA3lQiP4CHw80ipKPYTrQcMGX/vVp/PAO0qsZQKhJKgnyuye7gAAx9dxTqao= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702486087; c=relaxed/simple; bh=BKDayOjoRw97aeVTsrixomJU1K7QtGmubltXiCN5IG8=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=Y6bC1a0qFo2pHhF/6v4jVV6gca3gSF+dLkCb66iwrpMN30617jDHd5gkzTOYNWQO/ixrZyOs4fTcFvzxO+o0aVMTUc2YmKMDJFQEI4J7nyEPSwomghXFQDgMewIsgUJoU6YxTSI/ZGCnwk0xdEocyVvAxm4x/NXw/Fb4+H8hor4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702486076; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uOsEPe1ZWRgKAULfx7WismIE7BcIIpo1SkPFjoXy9rc=; b=Q3Ok5PCNuNELwGAp6BkmdwpaKlwbOJeuh4tjhbnug1ijJ00EpVsMX2Vhz2vmiyqSptH3gG HKvyWVsjomzL+KD60W6BSVoyjcFFPoQd1mgWECooCp+FRw7A0B6MMbTqyD2FkXJstKRWO+ 3N/QE0eMHhRzpoFh0RU+9byl+Ro+FtM= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-316-a76eH9O6MCyj1V2Xt6zBrQ-1; Wed, 13 Dec 2023 11:47:46 -0500 X-MC-Unique: a76eH9O6MCyj1V2Xt6zBrQ-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-77f96e14ee2so86184185a.1 for ; Wed, 13 Dec 2023 08:47:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702486065; x=1703090865; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uOsEPe1ZWRgKAULfx7WismIE7BcIIpo1SkPFjoXy9rc=; b=QQkPexd8doEcZ4XpJgKLWUzXtUG1c27DhxNZConmcaSTKzquBEZFh363DoVMYqdx/H rtSYi4FtjMbzBpNVAOeskr6b5+AHKVmRN9+32qk+ukQwLwP8x31HUjyFardf/TNe4eLy Ga8NNmVDDHQauDz0DiMc11MWKfSav0OOOLbdjeuXwf7ljJ+4KuJG/DYPnU1L9654AvHA z7wliNvQ0fLA0/BTbnHV554SlorBj/9uVZPhSiEMpL9rzSDdFGyffh4TT2ISdij1NtDH EZ+cWYi4agVUbtbaF+lfQkAc4GKne3GeUT1pzclQAJ3PQ656Uj501/0NDa2f0wpf0po+ 0+Ew== X-Gm-Message-State: AOJu0YynMkhVnux7+aPcsHs01ExfBWw5xjI0Ggz7vMaSwN1JbFtz0E7X 76XYnoBbFqU/3mkBdNA0/XHOTngP6JDBQjJWIycRA6UnQDSVsSDeey7KNMzdeYeuKhp9pC66lCM gKBSy7BifpxSgYVzP1wxT/I+DYe9jfJxhaKF33jc4+EowJy10Ioenq49LsybBELZNYoLLKvXg9g == X-Received: by 2002:a05:620a:5603:b0:77f:272f:1e5a with SMTP id vu3-20020a05620a560300b0077f272f1e5amr9317050qkn.60.1702486065416; Wed, 13 Dec 2023 08:47:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IE/lRq1dJCdA+47vgdniTMMK1kihfJAReahOD+IT0HhsTF1NY2UoI5OgeqmIUWg/6eDn1YLJQ== X-Received: by 2002:a05:620a:5603:b0:77f:272f:1e5a with SMTP id vu3-20020a05620a560300b0077f272f1e5amr9317042qkn.60.1702486065048; Wed, 13 Dec 2023 08:47:45 -0800 (PST) Received: from jason.com (130-44-146-16.s12558.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.146.16]) by smtp.gmail.com with ESMTPSA id j25-20020a05620a0a5900b0077f37896f24sm4613249qka.97.2023.12.13.08.47.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 08:47:44 -0800 (PST) From: Jason Merrill To: gcc-patches@gcc.gnu.org Subject: [pushed 3/4] c++: fix in-charge parm in constexpr Date: Wed, 13 Dec 2023 11:47:39 -0500 Message-Id: <20231213164740.1591535-3-jason@redhat.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231213164740.1591535-1-jason@redhat.com> References: <20231213164740.1591535-1-jason@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_SORBS_WEB,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Tested x86_64-pc-linux-gnu, applying to trunk. -- 8< -- I was puzzled by the proposed patch for PR71093 specifically ignoring the in-charge parameter; the problem turned out to be that when cxx_eval_call_expression jumps from the clone to the cloned function, it assumes that the latter has the same parameters, and so the in-charge parm doesn't get an argument. Since a class with vbases can't have constexpr 'tors there isn't actually a need for an in-charge parameter in a destructor, but we used to use it for deleting destructors and never removed it. I have a patch to do that for GCC 15, but for now let's work around it. gcc/cp/ChangeLog: * constexpr.cc (cxx_eval_call_expression): Handle missing in-charge argument. --- gcc/cp/constexpr.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc index 4cf9dd71b05..9d9e96c2afd 100644 --- a/gcc/cp/constexpr.cc +++ b/gcc/cp/constexpr.cc @@ -3169,6 +3169,19 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t, ctx->global->put_value (remapped, arg); remapped = DECL_CHAIN (remapped); } + for (; remapped; remapped = TREE_CHAIN (remapped)) + if (DECL_NAME (remapped) == in_charge_identifier) + { + /* FIXME destructors unnecessarily have in-charge parameters + even in classes without vbases, map it to 0 for now. */ + gcc_assert (!CLASSTYPE_VBASECLASSES (DECL_CONTEXT (fun))); + ctx->global->put_value (remapped, integer_zero_node); + } + else + { + gcc_assert (seen_error ()); + *non_constant_p = true; + } /* Add the RESULT_DECL to the values map, too. */ gcc_assert (!DECL_BY_REFERENCE (res)); ctx->global->put_value (res, NULL_TREE); -- 2.39.3