From: Jason Merrill <jason@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] c++: Add testcase for DR 2604
Date: Mon, 14 Nov 2022 18:12:11 -0500 [thread overview]
Message-ID: <4f427a60-673e-92e5-9d32-754969d0899c@redhat.com> (raw)
In-Reply-To: <Y3Ip4JHD7cg8W8MG@tucnak>
On 11/14/22 01:43, Jakub Jelinek wrote:
> 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?
OK.
> 2022-11-13 Jakub Jelinek <jakub@redhat.com>
>
> * g++.dg/DRs/dr2604.C: New test.
>
> --- 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<typename>
> +[[noreturn]] void
> +foo ([[maybe_unused]] int i)
> +{
> + for (;;);
> +}
> +
> +template<>
> +void
> +foo<int> (int i) // { dg-warning "unused parameter 'i'" }
> +{
> +}
> +
> +template<typename>
> +void
> +bar (int i) // { dg-warning "unused parameter 'i'" }
> +{
> +}
> +
> +template<>
> +[[noreturn]] void
> +bar<int> ([[maybe_unused]] int i)
> +{
> + for (;;);
> +}
> +
> +[[noreturn]] void
> +baz ()
> +{
> + foo<long> (0);
> +}
> +
> +[[noreturn]] void
> +qux ()
> +{
> + foo<int> (0);
> +} // { dg-warning "'noreturn' function does return" }
> +
> +[[noreturn]] void
> +garply ()
> +{
> + bar<long> (0);
> +} // { dg-warning "'noreturn' function does return" }
> +
> +[[noreturn]] void
> +corge ()
> +{
> + bar<int> (0);
> +}
>
> Jakub
>
prev parent reply other threads:[~2022-11-14 23:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-14 11:43 Jakub Jelinek
2022-11-14 23:12 ` Jason Merrill [this message]
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=4f427a60-673e-92e5-9d32-754969d0899c@redhat.com \
--to=jason@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
/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).