public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105195] New: spurious warning label defined but not used with if constexpr
@ 2022-04-07 13:19 barry.revzin at gmail dot com
  2022-04-07 13:29 ` [Bug c++/105195] " mpolacek at gcc dot gnu.org
  2022-11-10 23:50 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: barry.revzin at gmail dot com @ 2022-04-07 13:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105195

            Bug ID: 105195
           Summary: spurious warning label defined but not used with if
                    constexpr
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: barry.revzin at gmail dot com
  Target Milestone: ---

Similar to other "if constexpr" related warnings, gcc warns on this example:

void g();
void h();

template <bool B>
void f() {
    if constexpr (B) {
        goto label;
    }

    g();

label:
    h();
}

int main() {
    f<false>();
}

<source>:12:1: warning: label 'label' defined but not used [-Wunused-label]
   12 | label:
      | ^~~~~

But the label is used, just not in this particular instantiation.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-10 23:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-07 13:19 [Bug c++/105195] New: spurious warning label defined but not used with if constexpr barry.revzin at gmail dot com
2022-04-07 13:29 ` [Bug c++/105195] " mpolacek at gcc dot gnu.org
2022-11-10 23:50 ` pinskia at gcc dot gnu.org

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).