This error occurred several times when ever I try to compile my code, but unfortunely, it crushed every time, haha, my code:
template<class T>
class EnumSet
{
private:
T v;
public:
typedef T EnumType;
typedef EnumSet<T> SelfType;
public:
inline EnumSet(T def)
{
v=def;
}
inline EnumSet(SelfType& def)
{
v=def.v;
}
inline EnumSet()
{
v=T::Empty;
}
//I removed some detail operating codes for short.
};
and I define a poly state enum set:
enum _PolyState
{
Empty=0,
Active=1,
Clipped=2,
Backface=4
};
typedef EnumSet<_PolyState> PolyState;
everything is ok now, now I try to define a PolyState instance:
PolyState state(PolyState::EnumType::Clipped);
compile it, see what happens, hehe
and the IDE says: Error 3 fatal error C1001: An internal error has occurred in the compiler. xxx.cpp 58
this is a severe bug, my compiler is VC++ 2005 Express.

WARNING: My simple codes crushed the compiler several times.
Doug M
But when I try to initialize it with this statement:
PolyState state(_PolyState::Clipped);
it successed passed. hehe
DotSlashMartyn
This is arguably a crash on invalid code, though: enums aren't really namespaces. The rules laid out in the C++ standard for name lookup are reasonably complex and IMO trying to address an enum parameter through a typedef in a template is just asking for trouble.
enum values are placed in the namespace containing the enum definition, i.e. Clipped is actually defined in the global namespace (or your top-level namespace if you define one). So the correct initialization would be
Sobot
Rago
You should report it in the bug database at http://lab.msdn.microsoft.com/productfeedback/
Here's a shorter testcase to give them:
template
<class T> class C{
public:
typedef T EnumType;
};
enum E
{
A = 1
};
int main(void)
{
return C<E>::EnumType::A;
}
backwater
OK, I misunderstood. You said it was a serious error and IMO a crash on invalid code is not serious. There's an easy work around: fix your code!
There are much more serious classes of compiler bugs you could get, e.g. misoptimization or internal compiler error on valid code. So do go and log this on the bug database but I don't see that it's a big deal.
jeff______