This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/13407] New: Confusing error message from extraneous typename


Consider the following code sample:
    struct A { };
    struct B { typedef A Type; };

    template <typename T>
    struct X : public typename T::Type
    { };

    X<B> x;

The mainline compiler gives the following error messages:
bc.cc:5: error: expected class-name
bc.cc:5: error: expected `{'
bc.cc:6: error: expected unqualified-id
bc.cc:6: error: expected `;'
...

An error message is appropriate, since the code really is wrong.  However, a naive user (even a 
sophisticated user!) would be hard pressed to figure out the real reason for this cascade of errors: 
'typename' is forbidden in a base-specifier.

This is a regression from 3.3.  The 3.3 error messages were pretty bad too, but at least they gave a 
hint that the problem had something to do with 'typename'.

-- 
           Summary: Confusing error message from extraneous typename
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: austern at apple dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet:  i686-pc-linux-gnu
  GCC host triplet:  i686-pc-linux-gnu
GCC target triplet:  i686-pc-linux-gnu


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]