I couldn't find any information on Google about this, In the following example:
#include <iostream>
class Default
{
public:
void Print()
{
std::cout << "This is a message\n";
}
};
template <class C = Default>
class Template
{
public:
static void Test()
{
Default oDefault();
}
};
int main()
{
return 0;
}
the code fails to compile with the error:
In static member function ‘static void Template::Test()’: 19:22: error: default template arguments may not be used in function templates without -std=c++0x or -std=gnu++0x
The trouble is that it doesn't like the brackets appearing on that line and I don't understand why. If I remove the brackets the code compiles just fine. Also if I remove the template declaration (line 13) it also compiles just fine. Is this a bug or is there some rule somewhere about exactly this situation?
I'm using g++4.6.1 (gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3))