This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c++/10530: [3.4 regression] Cannot access non-dependent type within nested template
- From: giovannibajo at libero dot it
- To: gcc-gnats at gcc dot gnu dot org
- Date: 28 Apr 2003 23:32:00 -0000
- Subject: c++/10530: [3.4 regression] Cannot access non-dependent type within nested template
- Reply-to: giovannibajo at libero dot it
>Number: 10530
>Category: c++
>Synopsis: [3.4 regression] Cannot access non-dependent type within nested template
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Mon Apr 28 23:36:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Giovanni Bajo
>Release: 3.4 i686-pc-cygwin
>Organization:
>Environment:
Reading specs from /usr/local/lib/gcc-lib/i686-pc-cygwin/3.4/specs
Configured with: ../gcc/configure --program-suffix=-3.4 --enable-languages=c,c++
Thread model: single
gcc version 3.4 20030413 (experimental)
>Description:
GCC 3.4 does not compile the following legal snippet:
---------------------------------
template <typename T>
struct Foo
{
template <typename Q>
struct Inner
{
typedef int type;
};
};
struct Bar
{
template <typename A>
void func(void)
{
typedef typename
Foo<int>
::Inner<int>
::type type;
}
};
int main()
{
Bar b;
b.func<int>();
}
---------------------------------
newbug.cpp: In member function `void Bar::func()':
newbug.cpp:19: error: no type named `type' in `struct Foo<int>::Inner<int>'
newbug.cpp:19: error: ISO C++ forbids declaration of `type' with no type
I also tried adding the nested template keyword (which is unneeded because the postfix-expression is clearly non-dependent) but it does not help.
Previous GCCs compile the above correctly.
>How-To-Repeat:
Compile the snippet
>Fix:
No known workaround
>Release-Note:
>Audit-Trail:
>Unformatted: