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

            Bug ID: 92696
           Summary: #pragma GCC diagnostic ... interferes with if/else
           Product: gcc
           Version: 9.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sbergman at redhat dot com
  Target Milestone: ---

At least with "gcc (GCC) 9.2.1 20190827 (Red Hat 9.2.1-1)" and with recent GCC
10 trunk:

> $ cat test.c
> void f(int);
> void g(int b) {
>   if (b)
>     f(0);
> #pragma GCC diagnostic ignored "-Wformat"
>   else
>     f(1);
> }

> $ gcc -fsyntax-only test.c
> test.c: In function ‘g’:
> test.c:6:3: error: ‘else’ without a previous ‘if’
>     6 |   else
>       |   ^~~~

Reply via email to