Q
Qingning Huo
[Repost to comp.lang.c++]
Hi,
Is this valid C++? It compiles on VC8 and g++ 4.1.1, but fails on Sun
CC 5.8.
--cut --
template<class T>
class TClass
{
public:
void f(int x = T::EnumID);
};
class Unknown;
class X
{
public:
TClass<Unknown> m;
};
-- cut --
The error message of Sun CC is:
-- cut --
"enumid.cc", line 5: Error: EnumID is not a member of Unknown.
"enumid.cc", line 13: Where: While specializing "TClass<Unknown>".
"enumid.cc", line 13: Where: Specialized in non-template code.
1 Error(s) detected.
-- cut --
Defining class Unknown before class X makes it compile on Sun CC. I am
wondering which compiler is correct?
Qingning
Hi,
Is this valid C++? It compiles on VC8 and g++ 4.1.1, but fails on Sun
CC 5.8.
--cut --
template<class T>
class TClass
{
public:
void f(int x = T::EnumID);
};
class Unknown;
class X
{
public:
TClass<Unknown> m;
};
-- cut --
The error message of Sun CC is:
-- cut --
"enumid.cc", line 5: Error: EnumID is not a member of Unknown.
"enumid.cc", line 13: Where: While specializing "TClass<Unknown>".
"enumid.cc", line 13: Where: Specialized in non-template code.
1 Error(s) detected.
-- cut --
Defining class Unknown before class X makes it compile on Sun CC. I am
wondering which compiler is correct?
Qingning