| 1 |
// PR c++/113582 |
| 2 |
// { dg-do compile { target c++17 } } |
| 3 |
// { dg-options "-Wunused-label" } |
| 4 |
|
| 5 |
template<bool B> void |
| 6 |
do_something () |
| 7 |
{ |
| 8 |
#pragma GCC diagnostic push |
| 9 |
#pragma GCC diagnostic ignored "-Wunused-label" |
| 10 |
start: |
| 11 |
if constexpr(B) |
| 12 |
goto start; |
| 13 |
#pragma GCC diagnostic pop |
| 14 |
} |
| 15 |
|
| 16 |
template<bool B> void |
| 17 |
do_something2 () |
| 18 |
{ |
| 19 |
start: // { dg-warning "defined but not used" } |
| 20 |
if constexpr(B) |
| 21 |
goto start; |
| 22 |
} |
| 23 |
|
| 24 |
void |
| 25 |
g () |
| 26 |
{ |
| 27 |
do_something<0>(); |
| 28 |
do_something2<0>(); |
| 29 |
} |