From patchwork Mon Nov 14 11:43:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 19727 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2096558wru; Mon, 14 Nov 2022 03:44:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf5BknXK1ktXYj+ttkkzZ0Np3MJaP2XQXUbyhz8KxRrebCS2yI4t1FJ1YHfq0YioxuwQnU4p X-Received: by 2002:a17:906:f208:b0:7ae:2277:9fec with SMTP id gt8-20020a170906f20800b007ae22779fecmr9737260ejb.623.1668426262070; Mon, 14 Nov 2022 03:44:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426262; cv=none; d=google.com; s=arc-20160816; b=aUiIqtPWhDVBNJcSX0DC6JtEtDRRqSclYBd24kJ3+QBzVqr/8W5t5FfDpzpmJV7A6a UflOfk4wfNS6KTFB3R8nGHV7ISDaEhM7Xzvqi9RdaVYeBZ+9kuL14UZfuObWHvNRulgs jzHfpE4sOvgAmbJufiqGv3h6M6GDygX39kKgPcWKdfEHSTQg3iZTpndwFz8/W6DJcBlr nC6DY6AFEv2f/b/CPQNyQNtwELjSftBq7ir7L6ATT+6jl7O1UdJvOeLvMAiBMZiQqd+X fp7pKLexI3H2mMvIbhqwxCQeJjVLrVaw5RxvRCUu3N2m2X6j4w+SjyZYPTaj0GWJxGSc v92Q== 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-disposition:mime-version:message-id:subject:cc:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=yIGwUJDzYvCIW+XVUCv/wSEzZ73GM5O9MG5VOktg82E=; b=COc6dPU4mWU2gMUNywWMlxGoHv5mCtRrZ/zrv+qsyAAOiQu5ke78Cdn+bzWfweAxHv YeuDWWd1sTL15NEOYp635e0v2GIXtV2I2XffZrmVcM38IGE4wAfohbZy7IHSiHr9rnSL EvjCDmtrQljBFPjh4ZeX3Q1cOJdPzeSK8phYRC6LMsPhm3sl44zA8m//lxCobbM+6uIM UpiyvfwoCf/26keWw1oSwoMqXfXWYDZokimUr7zuKlmnT9+nR2V3x4Rbh8Lk4y0EFr/x vJvXkYjd+vFF2JLKOuPZeFhVZmpSZ/9sAPso2RGbRmQJM84qRAj+7CXw1PCGgaZBuXwa flmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=fljRkI7u; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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. [8.43.85.97]) by mx.google.com with ESMTPS id z16-20020a1709060f1000b0078c5d28e27esi6938894eji.604.2022.11.14.03.44.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Nov 2022 03:44:22 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=fljRkI7u; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 18A473858C54 for ; Mon, 14 Nov 2022 11:44:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 18A473858C54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668426261; bh=yIGwUJDzYvCIW+XVUCv/wSEzZ73GM5O9MG5VOktg82E=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=fljRkI7ucqKKkkXGAq7K/gj2Wf1DcE1s42JMgk3hTvyYAUOVeg5VisB5byfgWaKvB rk/NTT2EvmvTM1aq2oYQosCoxX9DGPVd0RniwH9Gr9Wh9C9fb1HEzSKS2aS4ssyexq OTkj8crEW7izhIdrti8A89zBIXfToGJBdSjX4eBI= 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.133.124]) by sourceware.org (Postfix) with ESMTPS id 7EB073858421 for ; Mon, 14 Nov 2022 11:43:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7EB073858421 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-330-RMvuF71BOsemU8vQRcfaQw-1; Mon, 14 Nov 2022 06:43:35 -0500 X-MC-Unique: RMvuF71BOsemU8vQRcfaQw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B9C453815D30 for ; Mon, 14 Nov 2022 11:43:34 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5B30239D6A; Mon, 14 Nov 2022 11:43:34 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 2AEBhTld2841938 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 14 Nov 2022 12:43:29 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 2AEBhSse2841937; Sun, 13 Nov 2022 23:43:28 -1200 Date: Sun, 13 Nov 2022 23:43:28 -1200 To: Jason Merrill Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] c++: Add testcase for DR 2604 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no 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: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek 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?1749471736334386283?= X-GMAIL-MSGID: =?utf-8?q?1749471736334386283?= Hi! Working virtually out of Baker Island. As the following testcase shows, I think we don't inherit template's attributes into specializations. Tested on x86_64-linux, ok for trunk? 2022-11-13 Jakub Jelinek * g++.dg/DRs/dr2604.C: New test. Jakub --- gcc/testsuite/g++.dg/DRs/dr2604.C.jj 2022-11-13 23:39:45.725712300 -1200 +++ gcc/testsuite/g++.dg/DRs/dr2604.C 2022-11-13 23:39:38.712807673 -1200 @@ -0,0 +1,53 @@ +// DR 2604 - Attributes for an explicit specialization. +// { dg-do compile { target c++11 } } +// { dg-options "-Wunused-parameter" } + +template +[[noreturn]] void +foo ([[maybe_unused]] int i) +{ + for (;;); +} + +template<> +void +foo (int i) // { dg-warning "unused parameter 'i'" } +{ +} + +template +void +bar (int i) // { dg-warning "unused parameter 'i'" } +{ +} + +template<> +[[noreturn]] void +bar ([[maybe_unused]] int i) +{ + for (;;); +} + +[[noreturn]] void +baz () +{ + foo (0); +} + +[[noreturn]] void +qux () +{ + foo (0); +} // { dg-warning "'noreturn' function does return" } + +[[noreturn]] void +garply () +{ + bar (0); +} // { dg-warning "'noreturn' function does return" } + +[[noreturn]] void +corge () +{ + bar (0); +}