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]

Re: c++/10530: [3.4 regression] Cannot access non-dependent type within nested template


Synopsis: [3.4 regression] Cannot access non-dependent type within nested template

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Tue Apr 29 00:19:14 2003
State-Changed-Why:
    Correct. Even smaller:
    --------------------------
    template <typename T>
    struct Foo {
        struct Inner {
            typedef int type;
        };
    };
    
    template <typename A> struct Bar {
        typedef typename Foo<int>::Inner::type type;
    };
    ------------------------------
    
    This won't compile with present mainline:
    g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
    x.cc:9: error: no type named `type' in `struct Foo<int>::Inner'
    x.cc:9: error: ISO C++ forbids declaration of `type' with no type
    
    If now someone (probably rightfully) argues that the
    "typename" is not necessary here -- this is what we get
    in that case:
    g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
    x.cc:9: error: type `Foo<int>::Inner' is not derived from type `Bar<A>'
    x.cc:9: error: ISO C++ forbids declaration of `type' with no type
    x.cc:9: error: expected `;'
    
    Ups, that's even worse...
    
    For the record: icc7 compiles it with and without the
    typename stuff. So does gcc3.3, so this is indeed a regression.
    
    W.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10530


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