B
Boltar
hi
I've come across a wierd template related error with gcc 3.4.6 on
linux. It doesn't occur with 3.3.3 or 4.2.1 so I'm wondering if its a
compiler bug or the compiler is just being extra pedantic (however
using -fpermissive makes no difference).
The error is:
$ c++ t.cc
t.cc: In member function `void n2<T>::test()':
t.cc:15: error: `wibble' was not declared in this scope
$
the code is:
template <typename T>
class n1
{
public:
int wibble;
};
template<typename T>
class n2: public n1<T>
{
public:
void test()
{
wibble = 1;
}
};
int main()
{
n2<int> n;
return 0;
}
It can be fixed by changing wibble=1 to this->wibble=1 but clearly
doing this in a large program for every single inherited base class
variable and function is not practical.
Anyone come across this before and know the solution or do we just
need to dump this version of gcc?
Thanks for any help
B2003
I've come across a wierd template related error with gcc 3.4.6 on
linux. It doesn't occur with 3.3.3 or 4.2.1 so I'm wondering if its a
compiler bug or the compiler is just being extra pedantic (however
using -fpermissive makes no difference).
The error is:
$ c++ t.cc
t.cc: In member function `void n2<T>::test()':
t.cc:15: error: `wibble' was not declared in this scope
$
the code is:
template <typename T>
class n1
{
public:
int wibble;
};
template<typename T>
class n2: public n1<T>
{
public:
void test()
{
wibble = 1;
}
};
int main()
{
n2<int> n;
return 0;
}
It can be fixed by changing wibble=1 to this->wibble=1 but clearly
doing this in a large program for every single inherited base class
variable and function is not practical.
Anyone come across this before and know the solution or do we just
need to dump this version of gcc?
Thanks for any help
B2003