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

            Bug ID: 113582
           Summary: incorrect warning about unused label
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nmmm at nmmm dot nu
  Target Milestone: ---

This code:

template<bool B>
void do_something(){
        #pragma GCC diagnostic push
        #pragma GCC diagnostic ignored "-Wunused-label"

        start:

        if constexpr(B)
                goto start;

        #pragma GCC diagnostic pop
}

int main(){
        do_something<0>();
}

Generates a warning:

warning: label ‘start’ defined but not used [-Wunused-label]

pragma GCC diagnostic did not work as well.

Reply via email to