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 EA0AD3858C83 for ; Mon, 28 Feb 2022 16:18:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EA0AD3858C83 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.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-620-TLhgVFBSPiiNtCRyc-8KDQ-1; Mon, 28 Feb 2022 11:18:11 -0500 X-MC-Unique: TLhgVFBSPiiNtCRyc-8KDQ-1 Received: by mail-qk1-f199.google.com with SMTP id s71-20020a37a94a000000b00648c7f2b289so11502972qke.12 for ; Mon, 28 Feb 2022 08:18:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Uk7qCIT07tpcH2GA0K9mAWJeyJFk4fIFmc3BIPZ+HeM=; b=ed5fFRnh59Lfif3RPYTWRZrwT0/u2kqOBGTkDcVDQWbBSYviMW+3Q5kZReOIsm0OW3 asgxqzJz80FZ8Tv+ClVr5V+ZWAivWhPDvPuxRLw9w8FCeWhUJY7vMMxkVYaGA0A9veak 4rF4zyW3BbSxqKLZGzvP2iPOcnjiili2TBtRwljgLvbBMtfCF3JwZmGc1dtF0x8R374A Oq7u8cKIXzCkj8EuyuyC/BjIBEfX9/NgjyY4YyDkNVc7LV4nGL3Zj/L69cfmVMgGojzL Au9grsMWLVaxRE17ujY5pg8iTIz7DrhWmR1vSoZaCNbKrtnAh7GiE2z95WS/HAyq4Pvr iiFg== X-Gm-Message-State: AOAM531C2dDO7YGIF6Z9D2g+H4LTtj7YejbfBdqCK6Ca8U0PXXGN0SUh rO0evzpHZovfJJa//AS5gsxUnukAI/2j/2fJ8zQmr8eY3QWZ2rwl1/nGZMoPyvxWKr8iEYtTpYj 5YUVsxl2nCB36ZaCsxQ== X-Received: by 2002:ad4:5c85:0:b0:42c:4d35:37e2 with SMTP id o5-20020ad45c85000000b0042c4d3537e2mr8477028qvh.90.1646065091088; Mon, 28 Feb 2022 08:18:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJwXA8sAL3MNo7Hygzt6VJNjZkIbrMmS7A1tTU3L0v3ULfVWU5r0BKYZTuLdHvzNRsflONfHUA== X-Received: by 2002:ad4:5c85:0:b0:42c:4d35:37e2 with SMTP id o5-20020ad45c85000000b0042c4d3537e2mr8477007qvh.90.1646065090819; Mon, 28 Feb 2022 08:18:10 -0800 (PST) Received: from redhat.com ([2601:184:4780:4310::3f37]) by smtp.gmail.com with ESMTPSA id p7-20020a05622a13c700b002de9f3894c2sm7339486qtk.50.2022.02.28.08.18.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 08:18:10 -0800 (PST) Date: Mon, 28 Feb 2022 11:18:08 -0500 From: Marek Polacek To: Jason Merrill Cc: GCC Patches , Iain Sandoe Subject: Re: [PATCH] c++: Lost deprecated/unavailable attr in class tmpl [PR104682] Message-ID: References: <20220225215921.324060-1-polacek@redhat.com> <97974b6a-98ec-6753-07ea-ff96ba15e92f@redhat.com> MIME-Version: 1.0 In-Reply-To: <97974b6a-98ec-6753-07ea-ff96ba15e92f@redhat.com> User-Agent: Mutt/2.1.5 (2021-12-30) X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Mon, 28 Feb 2022 16:18:16 -0000 On Mon, Feb 28, 2022 at 12:13:36PM -0400, Jason Merrill wrote: > On 2/25/22 17:59, Marek Polacek wrote: > > [ Most likely a GCC 13 patch, but I'm posting it now so that I don't lose it. ] > > > > When looking into the other PR I noticed that we fail to give a warning > > for a deprecated enumerator when the enum is in a class template. This > > only happens when the attribute doesn't have an argument. The reason is > > that when we tsubst_enum, we create a new enumerator: > > > > build_enumerator (DECL_NAME (decl), value, newtag, > > DECL_ATTRIBUTES (decl), DECL_SOURCE_LOCATION (decl)); > > > > but DECL_ATTRIBUTES (decl) is null when the attribute was provided > > without an argument -- in that case it simply melts into a tree flag. > > handle_deprecated_attribute has: > > > > if (!args) > > *no_add_attrs = true; > > > > so the attribute isn't retained and we lose it when tsubsting. Same > > thing when the attribute is on the enum itself. > > > > Attribute unavailable is a similar case, but it's different in that > > it can be a late attribute whereas "deprecated" can't: > > Iain, was this difference intentional? FWIW, I'm in favor of treating deprecated/unavailable the same, that is, adding unavailable... > > is_late_template_attribute has > > > > /* But some attributes specifically apply to templates. */ > > && !is_attribute_p ("abi_tag", name) > > && !is_attribute_p ("deprecated", name) ...here. But that really does seem like a GCC 13 change. > > && !is_attribute_p ("visibility", name)) > > return true; > > else > > return false; > > > > which looks strange, but attr-unavailable-9.C tests that we don't error when > > the attribute is applied on a template. > > > > Bootstrapped/regtested on x86_64-pc-linux-gnu. > > This looks extremely safe, so let's go ahead and apply it to trunk. Will do, thanks. Marek