public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54164] New: C++11: confusion error messages for spurious "typename"
@ 2012-08-03 10:23 akim.demaille at gmail dot com
  2020-03-12 18:17 ` [Bug c++/54164] C++11: confusing " mpolacek at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: akim.demaille at gmail dot com @ 2012-08-03 10:23 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 54164
           Summary: C++11: confusion error messages for spurious
                    "typename"
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: akim.demaille@gmail.com


Hi all,

The error message on the following input is really confusing, as G++ seems to
complain about the left-hand side of the declaration.  And then its error
recovery triggers another error pretending we should be in a namespace.

$ cat foo.cc
struct base
{};

struct derived
{
  using type = typename base;
};

$ g++-mp-4.8 -std=c++11 -Wall foo.cc
foo.cc:6:9: error: expected nested-name-specifier before 'type'
   using type = typename base;
         ^
foo.cc:6:9: error: using-declaration for non-member at class scope
foo.cc:6:14: error: expected ';' before '=' token
   using type = typename base;
              ^
foo.cc:6:14: error: expected unqualified-id before '=' token
$ g++-mp-4.8 --version
g++-mp-4.8 (MacPorts gcc48 4.8-20120729_0) 4.8.0 20120729 (experimental)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ clang++ -std=c++11 -Wall foo.cc
foo.cc:6:25: error: expected a qualified name after 'typename'
  using type = typename base;
                        ^
foo.cc:6:24: error: expected ';' after alias declaration
  using type = typename base;
                       ^
                       ;
2 errors generated.


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

* [Bug c++/54164] C++11: confusing error messages for spurious "typename"
  2012-08-03 10:23 [Bug c++/54164] New: C++11: confusion error messages for spurious "typename" akim.demaille at gmail dot com
@ 2020-03-12 18:17 ` mpolacek at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-03-12 18:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54164

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed in GCC 4.9.0.  Now we say:

54164.C:6:25: error: expected nested-name-specifier before ‘base’
    6 |   using type = typename base;
      |

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

end of thread, other threads:[~2020-03-12 18:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-03 10:23 [Bug c++/54164] New: C++11: confusion error messages for spurious "typename" akim.demaille at gmail dot com
2020-03-12 18:17 ` [Bug c++/54164] C++11: confusing " mpolacek 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).