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
* [Bug c++/105195] spurious warning label defined but not used with if constexpr
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 ` mpolacek at gcc dot gnu.org
2022-11-10 23:50 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-04-07 13:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105195
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Keywords| |diagnostic
CC| |mpolacek at gcc dot gnu.org
Status|UNCONFIRMED |NEW
Last reconfirmed| |2022-04-07
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/105195] spurious warning label defined but not used with if constexpr
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
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-10 23:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105195
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
MSVC warns too:
<source>(12): warning C4102: 'label': unreferenced label
<source>(17): note: see reference to function template instantiation 'void
f<false>(void)' being compiled
clang does not though.
I think GCC should not warn either.
^ 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).