[Bug c++/67013] New: Compilation error for well-formed program with empty declaration in the global namespace

anders.granlund.0 at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Jul 26 00:46:00 GMT 2015


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

            Bug ID: 67013
           Summary: Compilation error for well-formed program with empty
                    declaration in the global namespace
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anders.granlund.0 at gmail dot com
  Target Milestone: ---

Consider the following program:

  int main() {};

It is well-formed, the extra semi colon is just an empty declaration after the
definition of main.

Compile it with the following command line:

  g++ prog.cc -std=c++14 -pedantic-errors

The following error message is then given:

  prog.cc:1:14: error: extra ';' [-Wpedantic]
  int main() {};
              ^

I expected to get no error messages since the program is well-formed. For
comparison Clang gives no error message.

I have tried it with gcc HEAD 6.0.0 201507 here:

  http://melpon.org/wandbox/permlink/gaOys1DxBYMnRWei



More information about the Gcc-bugs mailing list