Problem With templates
Dinabandhu Mitra
dinabandhu@lifetreeindia.com
Wed Mar 28 11:21:00 GMT 2007
Hi,
The following code does not compile. The code seems all right and it
compiles on MSVC, HP-UX aCC and Solaris CC (Forte) compiler. I dont really
know why it does not on g++. I have tried gcc 3.4.5, 4.0.2 on linux.
Any work around is also ok.
#include <list>
template <class T>
class X
{
public:
struct B
{
};
void method()
{
B b;
std::list<B>::iterator c;
}
};
int main()
{
}
The error is given below
test_std.cpp: In member function `void X<T>::method()':
test_std.cpp:14: error: expected `;' before "c"
Regards,
Dinabandhu Mitra
More information about the Gcc-help
mailing list