deriving template classes: gcc 3.4 complains
Matt Austern
austern@apple.com
Thu Oct 2 23:21:00 GMT 2003
On Oct 1, 2003, at 11:51 AM, Gerald Pfeifer wrote:
> On Wed, 1 Oct 2003, Joachim Schoeberl wrote:
>> test34.cpp: In constructor `derived<A>::derived(int)':
>> test34.cpp:14: error: `i' undeclared (first use this function)
>> test34.cpp:14: error: (Each undeclared identifier is reported only
>> once
>> for each function it appears in.)
>>
>> Is there something wrong with my code ?
>
> I believe the third item under C++ at
>
> http://gcc.gnu.org/gcc-3.4/changes.html
>
> might be relevant here.
For more information, possibly more than you want, see section 9.4.2,
"Dependent Base Classes", of Vandevoorde and Josuttis's book _C++
Templates: The Complete Guide_.
This behavior is a fairly straightforward consequence of C++'s name
lookup rules. (Of course, I also have to admit that I didn't realize
this was a consequence of those rules until I started using a compiler
that actually enforced them. I think HP's compiler may have been the
first.)
--Matt
More information about the Gcc
mailing list