From patchwork Wed Mar 22 16:04:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 73511 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2422595wrt; Wed, 22 Mar 2023 09:06:00 -0700 (PDT) X-Google-Smtp-Source: AK7set8Ekl481VJSYFCw7D+a5COS+7t6z8OFZPvhPe9Mkk+NQeCgEpSnY9Ltt0JOR8MW2Swt7ClX X-Received: by 2002:a17:906:5815:b0:932:9303:76b9 with SMTP id m21-20020a170906581500b00932930376b9mr6764907ejq.26.1679501160463; Wed, 22 Mar 2023 09:06:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679501160; cv=none; d=google.com; s=arc-20160816; b=0Utlq0bGj6P6NXpfHdj5gJY00kCyKFsN3vnQ9LHLe/ipDEcmBqHJzntyO1ozus4ppp RYkXi938ULOkEFj1OEsLEQkgQqxrB4iRPwFvixW2dp7ptNo0E093SZOW654PxDjL9xPC nKgGzCIeBI/XYwsH19g5Z1XHFLy4hMW84TmeqHRClW410pSTdSfQilUOo7Mg7DNQfapW Ti/kfC0MtyyHZISNeaONwhXz4JLOPuBhFCMFV8dT7OZk38AnhTG8MpvzWjE0AqSz6FBL Wl6MvcrrgY+ICw6xSD20BvBFKByDpXyr0mpRL+AjTf0/X2yGmcqZoom3AM4Bp7KsrNtb hTVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=p1gbvyt2R0Fy7PlHLoilBOzbVS5gBTfHJcgU1LgltNk=; b=cMAk7FXL5m6pH+9pLeIzFGPCqNqN2E+8fs1KWrSmN9nalZV7f2l9CD3wT8cnxlScpx htWmUNI/ApRRNbCtHhqY2jOsLmYhMOFlETvATBz/m7WSg4zepMQrT+Z6Eop07EnV+Z9T Dxj4fllOxP2rVPeSR+YUt+vDpHe9dKA+ILYTbY4rGfy/cL1RBnBQC7XsMcO7FhrFQOhq SsUP+bweunWpvowccE2d2OPyfVRolqzTmL2YTVFgr2OeuUPtJZt/yekK1ZumRF9DLhdg mIGfaH7LJhy6dJACxaHGSvIK0BCS/93H4JzBDRJjszqQhlxI9GxvBhcVVIPDPeCsfgq0 flBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=raFYl+Bq; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id i9-20020a17090639c900b009246b3ddc33si1581279eje.372.2023.03.22.09.06.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Mar 2023 09:06:00 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=raFYl+Bq; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E407438515D6 for ; Wed, 22 Mar 2023 16:05:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E407438515D6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679501138; bh=p1gbvyt2R0Fy7PlHLoilBOzbVS5gBTfHJcgU1LgltNk=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=raFYl+Bq7Bz/KKty0CwEl3DpgV8PAD/2QldWBV4gO3UAQ5x/U/m9sOdHtzWUx1g+b c/PKlvWTJw060ZDNMGwZFW/sI7LO/lGU2HQU/27eA/JaJ1qdrtBbaOaLiGJIb1mE2P Dbpg3dF7Te2SYH0J3gSoNcbktUQcqQQpSI5qv6QQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 7FB6D3858D3C for ; Wed, 22 Mar 2023 16:04:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7FB6D3858D3C Received: from mail-yb1-f199.google.com (mail-yb1-f199.google.com [209.85.219.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-637-lPOrB8SoP_uSlsNdSdoaEg-1; Wed, 22 Mar 2023 12:04:53 -0400 X-MC-Unique: lPOrB8SoP_uSlsNdSdoaEg-1 Received: by mail-yb1-f199.google.com with SMTP id m6-20020a056902118600b00aeb1e3dbd1bso19731872ybu.9 for ; Wed, 22 Mar 2023 09:04:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679501093; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=p1gbvyt2R0Fy7PlHLoilBOzbVS5gBTfHJcgU1LgltNk=; b=WISZUvVw6N2/XTYDPE88q4J9sGACm/JilF1iMZDzUW+B0j9cjWxWmr7uha6raPkw9t 2sFEmt34OHFb6JhRenDC8GXa/l8/0nr0OxlOwNGnMbjBLjIJPcYZByPPMECQ6iBW6z1K WnEQcMQtWabtCplXMIraIIa6AIR7KicaCcsabOsh3u2Ao1BXZe0nSrRz/U+fDn6tDhfO qdMS9NHkhrrvFjupWcpkv5h1KOgXkMwyqaZ7/j/A3cFsDMpP0H5lyXSjL8BtP/KqiLDi yxerxNJhINUGdDqp73J/cLamFlRDWVWPduXsFwKojdH/1bftQt+Rm9V6CVByAntxyjqJ nLUA== X-Gm-Message-State: AAQBX9e2MrunoTak9Lib6utQx63LSSEe7xyOtxVORg8lDHy8745uIvKM kLlB1FGjXr/bMLf/1N2qkbYjZHQ8yMdlrX7teXZoOoMzbiqL9bllCf22EGSiNmnPvRArrT5tcRN DseY5u5Hz0eaGBMVYZtnIikedXoH9+wwEfzwiD9GKKpZuhyeK5CwOEth/JdogXc5faH7EITbj3A == X-Received: by 2002:a81:bb44:0:b0:544:7d28:1ff5 with SMTP id a4-20020a81bb44000000b005447d281ff5mr339104ywl.29.1679501092847; Wed, 22 Mar 2023 09:04:52 -0700 (PDT) X-Received: by 2002:a81:bb44:0:b0:544:7d28:1ff5 with SMTP id a4-20020a81bb44000000b005447d281ff5mr339057ywl.29.1679501092411; Wed, 22 Mar 2023 09:04:52 -0700 (PDT) Received: from jason.cygnus.com (130-44-159-43.s15913.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id f67-20020a37d246000000b00745daadd210sm11524997qkj.71.2023.03.22.09.04.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Mar 2023 09:04:51 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [pushed] c++: attribute on dtor in template [PR108795] Date: Wed, 22 Mar 2023 12:04:48 -0400 Message-Id: <20230322160448.2494466-1-jason@redhat.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.6 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_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jason Merrill via Gcc-patches From: Jason Merrill Reply-To: Jason Merrill Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761084608980244298?= X-GMAIL-MSGID: =?utf-8?q?1761084608980244298?= Tested x86_64-pc-linux-gnu, applying to trunk. -- 8< -- Since r7-2549 we were throwing away the explicit C:: when we found that ~C has an attribute that we treat as making its type dependent. PR c++/108795 gcc/cp/ChangeLog: * semantics.cc (finish_id_expression_1): Check scope before returning id_expression. gcc/testsuite/ChangeLog: * g++.dg/ext/attr-tsafe1.C: New test. --- gcc/cp/semantics.cc | 1 + gcc/testsuite/g++.dg/ext/attr-tsafe1.C | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 gcc/testsuite/g++.dg/ext/attr-tsafe1.C base-commit: d3a6f174543816600b1f472997d492088e4e396a diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc index 87c2e8a7111..99a76e3ed65 100644 --- a/gcc/cp/semantics.cc +++ b/gcc/cp/semantics.cc @@ -4238,6 +4238,7 @@ finish_id_expression_1 (tree id_expression, : CP_ID_KIND_UNQUALIFIED))); if (dependent_p + && !scope && DECL_P (decl) && any_dependent_type_attributes_p (DECL_ATTRIBUTES (decl))) /* Dependent type attributes on the decl mean that the TREE_TYPE is diff --git a/gcc/testsuite/g++.dg/ext/attr-tsafe1.C b/gcc/testsuite/g++.dg/ext/attr-tsafe1.C new file mode 100644 index 00000000000..20c319f154d --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attr-tsafe1.C @@ -0,0 +1,14 @@ +// PR c++/108795 + +template void g (T x) +{ + struct C + { + __attribute__((transaction_safe)) ~C(); + }; + C::~C(); // { dg-error "" } +} +void f () +{ + g (5); +}