Compile the test program below using this command line: g++ test.cpp
The code below fails to compile, and gives the following error message: -bash-3.00$ g++ test.cpp test.cpp: In member function `void Test::cell_test()': test.cpp:36: error: the default argument for parameter 1 of `void Test::Cell_base<Type>::set(Type, bool) [with Type = const char*]' has not yet been parsed class Test { protected: template< typename Type > class Cell_base { protected: bool m_relevance; Type m_field; public: Cell_base (void) // the constructor : m_relevance( false ), m_field( Type() ) { } // the setter void set (Type value, bool relevance = true) { m_relevance = relevance; m_field = value; } }; class Cell : public Cell_base< const char * > { }; public: //-------------------------------------------------- // Test out the cell classes //-------------------------------------------------- void cell_test (void) { Cell c; c.set( " To be or not to be \n\n" ); } }; //------------------------------ // Main - program entry //------------------------------ int main (int argc, char **argv) { Test t; t.cell_test(); return 0; } -- Summary: Default argument of template function causes a compile- time error Product: gcc Version: 3.4.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: SSacek at appsecinc dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21903