https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113582
--- Comment #1 from Nikolay Mihaylov <nmmm at nmmm dot nu> --- If you move the pragma outside the templated function, no warning is shown: #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-label" template<bool B> void do_something(){ start: if constexpr(B) goto start; } #pragma GCC diagnostic pop