Hi, I'm struggling with trying to get g++ (4.0.3 20051201 (prerelease) (Debian 4.0.2-5)) to compile the following code (which MSVC6 and SunForte have no problem with):
#include <map> template<class T> class rc { public: rc<T>() {} }; class SString { public: SString() {} }; class classA { public: classA() {} }; typedef std::map<SString, rc<classA> > tmap; // this works template<class C> class mymap { public: typedef std::map<SString, rc<C> > mmap; typedef rc<C> rcC; typedef std::map<SString, rcC > mmap2; mymap<C>() { tmap::const_iterator ti; mmap::const_iterator mi; // error: expected `;' before 'mi' mmap2::const_iterator mi2; // error: expected `;' before 'mi2' } }; int main(int argc, char *argv[]) { return 0; } [EMAIL PROTECTED]:~/$ g++ --version g++ (GCC) 4.0.3 20051201 (prerelease) (Debian 4.0.2-5) Copyright (C) 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [EMAIL PROTECTED]:~/$ g++ test.cpp test.cpp: In constructor 'mymap<C>::mymap()': test.cpp:32: error: expected `;' before 'mi' test.cpp:33: error: expected `;' before 'mi2' [EMAIL PROTECTED]:~/$ I cannot understand why g++ is not seeing mmap nor mmap2 as a type of std::map, I've been trying various work arounds and have now run out of ideas. Is it a bug, or do I have to do something to be more explicit? Regards, Ray __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]