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++/15946] New: Unhelpful error message when "typename" is omitted


Consider this test case:

template <class T> class Foo
{
public:
    typedef T bar;
    int x;
    T z;
};
template <class T> class Test: public Foo<T>
{
public:
    typedef T * t2;
    typedef Foo<T> F;
    
    t2 t;
    F f;
    typename F::bar b;
    typename Foo<T>::bar b2;
    F::bar b3;
    Foo<T>::bar b4;
};

Test<int> T2;

GCC 3.3.3 complains about the declarations of b3 and b4, saying that it's an
implicit typename and that's deprecated.

GCC 3.4.0 rejects the code outright.  Given that it's the next version, and it
was deprecated, that's ok.  What's not ok is the error message:

foo.cc:18: error: expected `;' before "b3"
foo.cc:19: error: expected `;' before "b4"

This gives no clue at all about what the problem is or how to correct it.

-- 
           Summary: Unhelpful error message when "typename" is omitted
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pkoning at equallogic dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-unknown-netbsdelf1.6.2
  GCC host triplet: i386-unknown-netbsdelf1.6.2
GCC target triplet: i386-unknown-netbsdelf1.6.2


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


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