[Bug c++/51186] New: declaring main() with auto but without --std=c++11 gives inconsistent error messages

wswiktor at poczta dot fm gcc-bugzilla@gcc.gnu.org
Thu Nov 17 09:01:00 GMT 2011


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

             Bug #: 51186
           Summary: declaring main() with auto but without --std=c++11
                    gives inconsistent error messages
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: wswiktor@poczta.fm


When I try to compile this code without specifying C++11 or C++0x standard

    auto main()->int
    {
    }

the following conflicting messages are generated:

    cpp.cpp:1:14: error: top-level declaration of 'main' specifies 'auto'
    cpp.cpp:1:14: error: 'main' function with late return type not declared
with 'auto' type specifier

The second one should be disabled when not in C++11 mode, or replaced with one
saying that funtions with late return type are not allowed.



More information about the Gcc-bugs mailing list