* [Bug c++/41690] Scoping is incorrect for inherited classes nested inside a templated class.
2009-10-13 0:31 [Bug c++/41690] New: Scoping is incorrect for inherited classes nested inside a templated class timothy dot renner at gmail dot com
@ 2009-10-13 1:08 ` paolo dot carlini at oracle dot com
2009-10-13 5:48 ` timothy dot renner at gmail dot com
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-10-13 1:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from paolo dot carlini at oracle dot com 2009-10-13 01:08 -------
Not a bug, use this->d_data.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41690
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/41690] Scoping is incorrect for inherited classes nested inside a templated class.
2009-10-13 0:31 [Bug c++/41690] New: Scoping is incorrect for inherited classes nested inside a templated class timothy dot renner at gmail dot com
2009-10-13 1:08 ` [Bug c++/41690] " paolo dot carlini at oracle dot com
@ 2009-10-13 5:48 ` timothy dot renner at gmail dot com
2009-10-13 5:56 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: timothy dot renner at gmail dot com @ 2009-10-13 5:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from timothy dot renner at gmail dot com 2009-10-13 05:47 -------
Thank you, I found that I could access it that way, and it makes a good
workaround. I'm curious why this is not a scoping bug though? It seems like
the compiler should still be able to scope d_data from the parent class,
especially as it works when the parent class is not templated. If that's not
true, could you please explain it to me? I'd like to understand this.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41690
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/41690] Scoping is incorrect for inherited classes nested inside a templated class.
2009-10-13 0:31 [Bug c++/41690] New: Scoping is incorrect for inherited classes nested inside a templated class timothy dot renner at gmail dot com
2009-10-13 1:08 ` [Bug c++/41690] " paolo dot carlini at oracle dot com
2009-10-13 5:48 ` timothy dot renner at gmail dot com
@ 2009-10-13 5:56 ` pinskia at gcc dot gnu dot org
2009-10-13 6:39 ` timothy dot renner at gmail dot com
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-10-13 5:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2009-10-13 05:56 -------
>the parent class is not templated.
Actually it is.
The name of the parent class really is templ<T>::A, which is a templated class.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41690
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/41690] Scoping is incorrect for inherited classes nested inside a templated class.
2009-10-13 0:31 [Bug c++/41690] New: Scoping is incorrect for inherited classes nested inside a templated class timothy dot renner at gmail dot com
` (2 preceding siblings ...)
2009-10-13 5:56 ` pinskia at gcc dot gnu dot org
@ 2009-10-13 6:39 ` timothy dot renner at gmail dot com
2009-10-13 10:26 ` paolo dot carlini at oracle dot com
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: timothy dot renner at gmail dot com @ 2009-10-13 6:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from timothy dot renner at gmail dot com 2009-10-13 06:38 -------
>Actually it is.
>
>The name of the parent class really is templ<T>::A, which is a templated class.
Sorry, my mistake, I mistyped that. Let me clarify. I didn't mean the parent
class, I meant the containing class. I'm not sure what the technical name is
for the class that houses a nested class. Classes A and B nested in class
templ<TYPE> are definitely templated, but what about classes A and B nested in
class notempl?
What I am curious about is that the compiler does recognize inheritance in a
templated class:
If I added public constructors to both A and B:
A() {}
and
B() : A() {}
A() is accessibile by class B, and that code will compile, but the compiler
does not recognize that d_data from A is accessible by B when templation is
involved, but does recognize it when templation is not involved.
I can see it being a more complicated case to parse correctly, but the current
behavior seems inconsistent to me and like something the compiler should not
throw an error on, so if there is a good reason why it should work the way it
currently does, I'd really like to learn what it is. If not, this bug should
be reopened and kept around at the very least as a "nice to have" feature since
it's easily worked around, or just flat out marked as a won't fix.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41690
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/41690] Scoping is incorrect for inherited classes nested inside a templated class.
2009-10-13 0:31 [Bug c++/41690] New: Scoping is incorrect for inherited classes nested inside a templated class timothy dot renner at gmail dot com
` (3 preceding siblings ...)
2009-10-13 6:39 ` timothy dot renner at gmail dot com
@ 2009-10-13 10:26 ` paolo dot carlini at oracle dot com
2009-10-13 11:03 ` redi at gcc dot gnu dot org
2009-10-13 11:56 ` paolo dot carlini at oracle dot com
6 siblings, 0 replies; 8+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-10-13 10:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from paolo dot carlini at oracle dot com 2009-10-13 10:26 -------
To be clear, the use of this-> isn't a "workaround", is the way C++ as
specified in the current International standard works. This is not the place
for general explanations, you may want to browse D. Vandevoorde and Nicolai M.
Josuttis, "C++ Templates", Addison Wesley, for a clear treatment of the this->,
typename, ::templte, .template, etc., subtleties and *much* more.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41690
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/41690] Scoping is incorrect for inherited classes nested inside a templated class.
2009-10-13 0:31 [Bug c++/41690] New: Scoping is incorrect for inherited classes nested inside a templated class timothy dot renner at gmail dot com
` (4 preceding siblings ...)
2009-10-13 10:26 ` paolo dot carlini at oracle dot com
@ 2009-10-13 11:03 ` redi at gcc dot gnu dot org
2009-10-13 11:56 ` paolo dot carlini at oracle dot com
6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu dot org @ 2009-10-13 11:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from redi at gcc dot gnu dot org 2009-10-13 11:02 -------
Or see http://gcc.gnu.org/gcc-3.4/changes.html#cplusplus
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41690
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/41690] Scoping is incorrect for inherited classes nested inside a templated class.
2009-10-13 0:31 [Bug c++/41690] New: Scoping is incorrect for inherited classes nested inside a templated class timothy dot renner at gmail dot com
` (5 preceding siblings ...)
2009-10-13 11:03 ` redi at gcc dot gnu dot org
@ 2009-10-13 11:56 ` paolo dot carlini at oracle dot com
6 siblings, 0 replies; 8+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-10-13 11:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from paolo dot carlini at oracle dot com 2009-10-13 11:55 -------
Yes, Jon. By the way, I also wanted to link to that *very* old changes doc,
probably gave up only because the examples are slightly different. But indeed,
that's exactly the point.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41690
^ permalink raw reply [flat|nested] 8+ messages in thread