Re: access to members of template base class
John Femiani wrote:
I have come across a problem using g++. The example below illustrates
the issue:
--------------------------------------------------------
#include <iostream>
template<class T>
struct A {
int member;
};;
template<class T>
struct B: A<T> {
void somefunc() {
std::cout << member << std::endl;
}
};
------------------------------------------
The code above compiles with vc8 but not g++ 3.4.2.
g++ complains that there is no symbol named 'member'..
If A and B are not a template classes then there is no problem.
Is there a bug in g++? or vc8? What is the proper behavior here?
Note that if I use this->member it compiles with g++ for some reason.
Search the FAQ (and the archives) for "dependent name". You can
answer your own question if you do some reading first.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask