[Bug c++/105195] New: spurious warning label defined but not used with if constexpr
barry.revzin at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Apr 7 13:19:32 GMT 2022
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.
More information about the Gcc-bugs
mailing list