public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51186] New: declaring main() with auto but without --std=c++11 gives inconsistent error messages
@ 2011-11-17  9:01 wswiktor at poczta dot fm
  2011-11-17 21:08 ` [Bug c++/51186] " jason at gcc dot gnu.org
  2011-11-17 21:08 ` jason at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: wswiktor at poczta dot fm @ 2011-11-17  9:01 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/51186] declaring main() with auto but without --std=c++11 gives inconsistent error messages
  2011-11-17  9:01 [Bug c++/51186] New: declaring main() with auto but without --std=c++11 gives inconsistent error messages wswiktor at poczta dot fm
@ 2011-11-17 21:08 ` jason at gcc dot gnu.org
  2011-11-17 21:08 ` jason at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jason at gcc dot gnu.org @ 2011-11-17 21:08 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jason at gcc dot gnu.org
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-11-17 21:05:00 UTC ---
Fixed to say

x.C:3:14: error: trailing return type only available with -std=c++11 or
-std=gnu++11


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/51186] declaring main() with auto but without --std=c++11 gives inconsistent error messages
  2011-11-17  9:01 [Bug c++/51186] New: declaring main() with auto but without --std=c++11 gives inconsistent error messages wswiktor at poczta dot fm
  2011-11-17 21:08 ` [Bug c++/51186] " jason at gcc dot gnu.org
@ 2011-11-17 21:08 ` jason at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jason at gcc dot gnu.org @ 2011-11-17 21:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2011-11-17 21:00:34 UTC ---
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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-11-17 21:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-17  9:01 [Bug c++/51186] New: declaring main() with auto but without --std=c++11 gives inconsistent error messages wswiktor at poczta dot fm
2011-11-17 21:08 ` [Bug c++/51186] " jason at gcc dot gnu.org
2011-11-17 21:08 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).