This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: deriving template classes: gcc 3.4 complains


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]