https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71215
Bug ID: 71215 Summary: Compile error when using in-class initialization of template class attributes (c++11) Product: gcc Version: 5.3.0 Status: UNCONFIRMED Severity: blocker Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: markprediger at gmail dot com Target Milestone: --- I can reproduce the bug on any gcc from version 4.7.3 to 5.3.0. gcc 6 seems not to be affected. Code (test.cpp): class x {}; template<class, class> class Member {}; class Object { Member<x, x> str = Member<x, x>(); // <- line 7 }; int main() { } Command line: g++ test.cpp -std=c++11 Error: test.cpp:7:31: error: expected ';' at end of member declaration Member<x, x> str = Member<x, x>(); ^ test.cpp:7:32: error: expected unqualified-id before '>' token Member<x, x> str = Member<x, x>(); ^ test.cpp:7:28: error: wrong number of template arguments (1, should be 2) Member<x, x> str = Member<x, x>(); ^ test.cpp:4:7: note: provided for 'template<class, class> class Member' class Member {}; If you replace x with a primitive type, no error occures. Also compiles with gcc 6.