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.
Author: jason Date: Thu Nov 17 21:00:30 2011 New Revision: 181455 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181455 Log: PR c++/51186 * decl.c (grokdeclarator): Improve C++98 trailing return diagnostic. Added: trunk/gcc/testsuite/g++.dg/cpp0x/auto27.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/cpp0x/trailing2.C
Fixed to say x.C:3:14: error: trailing return type only available with -std=c++11 or -std=gnu++11