[Bug c++/13641] New: calling main: standard requires diagnostic, but diagnostic only with --pedantic

bugzilla dot gcc at rtij dot nl gcc-bugzilla@gcc.gnu.org
Sat Jan 10 23:08:00 GMT 2004


Compiling the following program:

int main() { main(); }

Gives no diagnostic until --pedantic is given. The standard doesn't say that no
diagnostic is required, so one is required. In my opinion a diagnostic should be
issued, at least at -Wall.

Actual results:

$ g++ -c main.C
$ g++ -c --pedantic main.C
main.C: In function `int main()':
main.C:1: warning: ISO C++ forbids calling `::main' from within program
main.C:1: warning: ISO C++ forbids taking address of function `::main'

Expected results:
Build without --pedantic should give a diagnostic as well.

Build Date & Platform:
$ g++ --version
g++ (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)

Regards,
Martijn Lievaart

-- 
           Summary: calling main: standard requires diagnostic, but
                    diagnostic only with --pedantic
           Product: gcc
           Version: 3.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bugzilla dot gcc at rtij dot nl
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13641



More information about the Gcc-bugs mailing list