This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Problem With templates
- From: "Dinabandhu Mitra" <dinabandhu at lifetreeindia dot com>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Wed, 28 Mar 2007 16:32:02 +0530
- Subject: Problem With templates
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 don?t 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