This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/10530: [3.4 regression] Cannot access non-dependent type within nested template
- From: bangerth at dealii dot org
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, giovannibajo at libero dot it, nobody at gcc dot gnu dot org
- Date: 29 Apr 2003 00:19:14 -0000
- Subject: Re: c++/10530: [3.4 regression] Cannot access non-dependent type within nested template
- Reply-to: bangerth at dealii dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, giovannibajo at libero dot it, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
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