J
John Femiani
My message does not show up at all. Here it is again:
IN g++ 3.4.2 this does not compile:
#include <iostream>
template<class T>
struct A {
int member;
};
emplate<class T>
struct B: A<T>
{
void somefunc() {
std::cout << member << std::endl;
}
};
int main(int argc, char* argv[]){
B<int> b;
b.somefunc();
}
But it does on vc8.
Should this compile? Is there a bug on vc8? or g++?
g++ gives this error message:
test.cpp:15: error: `member' undeclared (first use this function)
replacing line 15 by:
std::cout << this->member << std::endl;
fixes it.
Also if I make A and B _not_ use templates all is fine.
My question is, is this a g++ bug or a vc8 bug?
-- John
IN g++ 3.4.2 this does not compile:
#include <iostream>
template<class T>
struct A {
int member;
};
emplate<class T>
struct B: A<T>
{
void somefunc() {
std::cout << member << std::endl;
}
};
int main(int argc, char* argv[]){
B<int> b;
b.somefunc();
}
But it does on vc8.
Should this compile? Is there a bug on vc8? or g++?
g++ gives this error message:
test.cpp:15: error: `member' undeclared (first use this function)
replacing line 15 by:
std::cout << this->member << std::endl;
fixes it.
Also if I make A and B _not_ use templates all is fine.
My question is, is this a g++ bug or a vc8 bug?
-- John