public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11118] New: Regression in 3.4 (cvs from jun 06) using nested classes in templates
@ 2003-06-06 21:35 lars@trolltech.com
2003-06-06 21:46 ` [Bug c++/11118] " pinskia@physics.uc.edu
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: lars@trolltech.com @ 2003-06-06 21:35 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11118
Summary: Regression in 3.4 (cvs from jun 06) using nested classes
in templates
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: lars@trolltech.com
CC: gcc-bugs@gcc.gnu.org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
The following code compiles fine in all versions < 3.4:
template<typename T> class Foo
{
public:
void foo();
class Data {
};
};
template<typename T> void Foo<T>::foo()
{
// compiles
Data *y;
// doesn't compile
Foo::Data *x;
}
[lars@binky gcc-bugs]$ gcc nested.cpp
nested.cpp: In member function `void Foo<T>::foo()':
nested.cpp:14: error: `x' has not been declared
[lars@binky gcc-bugs]$ gcc -v
Reading specs from /home/lars/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.4/specs
Configured with: ../gcc/configure --prefix=/home/lars/gcc --disable-libgcj
Thread model: posix
gcc version 3.4 20030605 (experimental)
Best regards,
Lars
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/11118] Regression in 3.4 (cvs from jun 06) using nested classes in templates
2003-06-06 21:35 [Bug c++/11118] New: Regression in 3.4 (cvs from jun 06) using nested classes in templates lars@trolltech.com
@ 2003-06-06 21:46 ` pinskia@physics.uc.edu
2003-06-07 0:31 ` bangerth@dealii.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia@physics.uc.edu @ 2003-06-06 21:46 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11118
------- Additional Comments From pinskia@physics.uc.edu 2003-06-06 21:46 -------
I can compile this if I put typename in front of Foo:Data but I do not know if this is required by the
standard.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/11118] Regression in 3.4 (cvs from jun 06) using nested classes in templates
2003-06-06 21:35 [Bug c++/11118] New: Regression in 3.4 (cvs from jun 06) using nested classes in templates lars@trolltech.com
2003-06-06 21:46 ` [Bug c++/11118] " pinskia@physics.uc.edu
@ 2003-06-07 0:31 ` bangerth@dealii.org
2003-06-07 8:36 ` lars@trolltech.com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: bangerth@dealii.org @ 2003-06-07 0:31 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11118
bangerth@dealii.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
------- Additional Comments From bangerth@dealii.org 2003-06-07 00:31 -------
Not a bug. Foo::Data is a template dependent type, so it needs to be prefixed
by "typename".
W.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/11118] Regression in 3.4 (cvs from jun 06) using nested classes in templates
2003-06-06 21:35 [Bug c++/11118] New: Regression in 3.4 (cvs from jun 06) using nested classes in templates lars@trolltech.com
2003-06-06 21:46 ` [Bug c++/11118] " pinskia@physics.uc.edu
2003-06-07 0:31 ` bangerth@dealii.org
@ 2003-06-07 8:36 ` lars@trolltech.com
2003-06-07 15:13 ` [Bug c++/11118] [3.4 only] missleading error message on missing typename pinskia@physics.uc.edu
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: lars@trolltech.com @ 2003-06-07 8:36 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11118
------- Additional Comments From lars@trolltech.com 2003-06-07 08:33 -------
Subject: Re: Regression in 3.4 (cvs from jun 06) using nested
classes in templates
Well, then at lest the error message is rather misleading.
Best regards,
Lars
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/11118] [3.4 only] missleading error message on missing typename
2003-06-06 21:35 [Bug c++/11118] New: Regression in 3.4 (cvs from jun 06) using nested classes in templates lars@trolltech.com
` (2 preceding siblings ...)
2003-06-07 8:36 ` lars@trolltech.com
@ 2003-06-07 15:13 ` pinskia@physics.uc.edu
2003-06-07 15:14 ` pinskia@physics.uc.edu
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia@physics.uc.edu @ 2003-06-07 15:13 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11118
pinskia@physics.uc.edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Keywords| |diagnostic
Resolution|INVALID |
Summary|Regression in 3.4 (cvs from |[3.4 only] missleading error
|jun 06) using nested classes|message on missing typename
|in templates |
------- Additional Comments From pinskia@physics.uc.edu 2003-06-07 15:13 -------
I am reopening this bug because it is a misleading error message with the missing
typename.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/11118] [3.4 only] missleading error message on missing typename
2003-06-06 21:35 [Bug c++/11118] New: Regression in 3.4 (cvs from jun 06) using nested classes in templates lars@trolltech.com
` (3 preceding siblings ...)
2003-06-07 15:13 ` [Bug c++/11118] [3.4 only] missleading error message on missing typename pinskia@physics.uc.edu
@ 2003-06-07 15:14 ` pinskia@physics.uc.edu
2003-06-09 1:24 ` bangerth@dealii.org
2003-06-09 11:28 ` giovannibajo@libero.it
6 siblings, 0 replies; 8+ messages in thread
From: pinskia@physics.uc.edu @ 2003-06-07 15:14 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11118
pinskia@physics.uc.edu changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned@gcc.gnu.org |gdr@gcc.gnu.org
Status|UNCONFIRMED |NEW
------- Additional Comments From pinskia@physics.uc.edu 2003-06-07 15:14 -------
Assigning to Diagnostic maintainer.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/11118] [3.4 only] missleading error message on missing typename
2003-06-06 21:35 [Bug c++/11118] New: Regression in 3.4 (cvs from jun 06) using nested classes in templates lars@trolltech.com
` (4 preceding siblings ...)
2003-06-07 15:14 ` pinskia@physics.uc.edu
@ 2003-06-09 1:24 ` bangerth@dealii.org
2003-06-09 11:28 ` giovannibajo@libero.it
6 siblings, 0 replies; 8+ messages in thread
From: bangerth@dealii.org @ 2003-06-09 1:24 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11118
bangerth@dealii.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gdr@integrable-solutions.net
------- Additional Comments From bangerth@dealii.org 2003-06-09 01:24 -------
I disagree with the statement that the diagnostics are insufficient, because
there is really not much the compiler can do. See, if no "typename" is
given, the compiler assumes that Foo::Data is a member function/variable.
Since no parentheses are following, it assumes a member variable, and the
star then means multiplication. So far so good, but multiplication with what?
"x" is not a declared variable. That's exactly what the compiler is trying to
tell you.
Honestly, I don't think there is much a compiler can do in this situation if
two-stage name lookup is properly implemented. I leave it to Gaby to decide
what to do with this PR.
Wolfgang
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/11118] [3.4 only] missleading error message on missing typename
2003-06-06 21:35 [Bug c++/11118] New: Regression in 3.4 (cvs from jun 06) using nested classes in templates lars@trolltech.com
` (5 preceding siblings ...)
2003-06-09 1:24 ` bangerth@dealii.org
@ 2003-06-09 11:28 ` giovannibajo@libero.it
6 siblings, 0 replies; 8+ messages in thread
From: giovannibajo@libero.it @ 2003-06-09 11:28 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11118
giovannibajo@libero.it changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |DUPLICATE
------- Additional Comments From giovannibajo@libero.it 2003-06-09 11:28 -------
This is a borderline case because the qualified-id is the injected-class-name
("Foo" is an alias of "Foo<T>"). DR224 clarifies that such names are "non-
dependent" because of the _semantic_ behind it (they can be looked-up at
template definition time, not instantiation), even if they appear to be
dependent from a _syntactic_ point of view (the qualified-id contains the
template parameter T).
In other words, the proposed code should not compile as per pure C++98, but
it's been recognized as a defect. You can consult DR224
(http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_defects.html#224) for more
examples.
We already have an open bug (PR9634) to track this, thus I close this bug as a
duplicate.
*** This bug has been marked as a duplicate of 9634 ***
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2003-06-09 11:28 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-06 21:35 [Bug c++/11118] New: Regression in 3.4 (cvs from jun 06) using nested classes in templates lars@trolltech.com
2003-06-06 21:46 ` [Bug c++/11118] " pinskia@physics.uc.edu
2003-06-07 0:31 ` bangerth@dealii.org
2003-06-07 8:36 ` lars@trolltech.com
2003-06-07 15:13 ` [Bug c++/11118] [3.4 only] missleading error message on missing typename pinskia@physics.uc.edu
2003-06-07 15:14 ` pinskia@physics.uc.edu
2003-06-09 1:24 ` bangerth@dealii.org
2003-06-09 11:28 ` giovannibajo@libero.it
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).