Hello, this is my first bug report, so please don't be harsh with me in case i did something wrong.
I'm on Ubuntu Jaunty i386, with all the packages installed from and updated to the most recent version of the official repositories. I'm trying to build for that system too (no cross-compiling). This is the g++ version I have: $ g++ --version g++ (Ubuntu 4.3.2-2ubuntu9) 4.3.3 20081217 (prerelease) $ g++ -dumpmachine i486-linux-gnu And this how I invoke g++: $ g++ -Wall test.cpp test.cpp:11: error: expected identifier before ';' token test.cpp:11: error: friend declaration does not name a class or function I have distilled the testcase to just a few lines, and saved them to test.cpp. I'll paste the contents here: template<typename T> class Outer { public: template<typename U> class Inner { }; }; template<typename V> class Friend { friend class Outer<V>::template Inner<int>; //line 11 }; I don't see why this code should not compile, and the "tryitout" version of Comeau compiles this in strict mode, and so does Visual C++ 2008. Unfortunately, I cannot install any other version of g++ right now, but I have asked someone with gcc 4.4.x on freenode ##C++ to try to compile that code snippet, and he had the same result as I had. geordi is a bot in that channel to which you can send small samples of code to compile, and it says it runs "g++ (GCC) 4.5.0 20090803 (experimental)". geordi cannot compile that code either. Can you please give me some insight into why this code fails to compile with g++? In any case, be it g++ that is wrong or right in refusing to compile, is there a workaround I can use to achieve what I need? I'm happy to assist you should you need further tests or data. -- Summary: Error when declaring a nested template member class of a dependent template class a friend Product: gcc Version: 4.3.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pleexed at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41231