public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/113582] incorrect warning about unused label with `pragma GCC diagnostic` around the unused label Date: Wed, 24 Jan 2024 23:01:15 +0000 [thread overview] Message-ID: <bug-113582-4-0rctNOMb7Z@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-113582-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113582 --- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> --- The reason I'm not doing simply TREE_USED (label) = TREE_USED (decl); in the pt.cc/LABEL_EXPR hunk is that I think we still want the warning in the second function, what with the goto being a discarded statement. // PR c++/113582 template<bool B> void do_something () { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-label" start: if constexpr(B) goto start; #pragma GCC diagnostic pop } template<bool B> void do_something2 () { start: // { dg-warning "defined but not used" } if constexpr(B) goto start; } void g () { do_something<0>(); do_something2<0>(); }
next prev parent reply other threads:[~2024-01-24 23:01 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-01-24 13:48 [Bug c++/113582] New: incorrect warning about " nmmm at nmmm dot nu 2024-01-24 14:31 ` [Bug c++/113582] " nmmm at nmmm dot nu 2024-01-24 21:13 ` mpolacek at gcc dot gnu.org 2024-01-24 21:19 ` [Bug c++/113582] incorrect warning about unused label with `pragma GCC diagnostic` around the " pinskia at gcc dot gnu.org 2024-01-24 22:59 ` mpolacek at gcc dot gnu.org 2024-01-24 23:01 ` mpolacek at gcc dot gnu.org [this message] 2024-01-30 16:12 ` mpolacek at gcc dot gnu.org 2024-05-08 16:22 ` cvs-commit at gcc dot gnu.org 2024-05-08 16:24 ` mpolacek at gcc dot gnu.org
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=bug-113582-4-0rctNOMb7Z@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /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: linkBe 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).