public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/10530: [3.4 regression] Cannot access non-dependent type within nested template
@ 2003-04-28 23:36 giovannibajo
0 siblings, 0 replies; 2+ messages in thread
From: giovannibajo @ 2003-04-28 23:36 UTC (permalink / raw)
To: gcc-gnats
>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:
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: c++/10530: [3.4 regression] Cannot access non-dependent type within nested template
@ 2003-04-29 0:19 bangerth
0 siblings, 0 replies; 2+ messages in thread
From: bangerth @ 2003-04-29 0:19 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, giovannibajo, nobody
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-04-29 0:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-28 23:36 c++/10530: [3.4 regression] Cannot access non-dependent type within nested template giovannibajo
2003-04-29 0:19 bangerth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).