Consider the following code:
When compiled with gcc 4.4, it throws the error:
Expected initializer before foo
at the afunction definition.
I don't understand why foo<T>::bar in that context does not name a type, this code works well outside a template.
Or, alternately, if you use:
It does not complain either...!
Regards.
Code:
template <typename T>
class foo
{
public:
enum bar {a,b,c};
bar afunction();
};
template <typename T>
foo<T>::bar foo<T>::afunction(){return a;}
When compiled with gcc 4.4, it throws the error:
Expected initializer before foo
at the afunction definition.
I don't understand why foo<T>::bar in that context does not name a type, this code works well outside a template.
Or, alternately, if you use:
Code:
template <typename T>
class foo
{
public:
enum bar {a,b,c};
bar afunction();
};
template class foo<int>;
foo<int>::bar foo<int>::afunction(){return a;}
It does not complain either...!
Regards.
Last edited: