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

            Bug ID: 93287
           Summary: _Static_assert creates spurious
                    -Wdeclaration-after-statement warnings
           Product: gcc
           Version: 9.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: markus at oberhumer dot com
  Target Milestone: ---

gcc 9 under Fedora 31: gcc version 9.2.1 20190827 (Red Hat 9.2.1-1) (GCC)

The small program below creates spurious warnings:

$ gcc -Wdeclaration-after-statement test.c

test.c: In function ‘main’:
test.c:4:5: warning: ISO C90 forbids mixed declarations and code
[-Wdeclaration-after-statement]
    4 |     _Static_assert(1 == 1, "error");
      |     ^~~~~~~~~~~~~~


$ cat test.c

int main() {
    int r;
    r = 0;
    _Static_assert(1 == 1, "error");
    return r;
}

Reply via email to