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: [email protected]
ReportedBy: [email protected]
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.