Compiler misbehavior and internal compiler error

While messing around with some metaprogramming stuff, I have just found out that writing this:

//***********************************

enum E
{
value = 0,
};


int _tmain(int argc, _TCHAR* argv[])
{
typedef void (E::* pEnumMember) (int);

}

//***********************************

The compiler does not say a word and compiles fine. If then you go on and do something like this:

//***********************************

enum E
{
value = 0,
};

struct S
{
void Function(int) {int a = 43;};
};


int _tmain(int argc, _TCHAR* argv[])
{
typedef void (E::* pEnumMember) (int);
pEnumMember p = reinterpret_cast<pEnumMember>(&S::Function);//upps
}

//***********************************

you get an internal compiler error.

fatal error C1001: An internal error has occurred in the compiler. (compiler file 'msc1.cpp', line 1392)

Thanks for your time.

[1332 byte] By [JaviMartin] at [2007-12-26]
# 1
Yeah... one of those cases where the compiler should be giving an error but ICEs instead. It's a low pri item for Microsoft, but something that gets eventually fixed if you put it on their radar. Go ahead and open a bug against it. Thanks.
BrianKramer at 2007-9-4 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 2

I've seen worst. For example there was this very simple program with a like of code like this:

size_t retvalue = FunctionThatReturnsInt();

That did issue an ICE. When a cast to size_t was put there, the program compiled successfully.

size_t retvalue = (size_t)FunctionThatReturnsInt();

MariusBancila at 2007-9-4 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 3
Creating a bug is the best way to muscle Microsoft into fixing it and/or be embarrassed about it. :)
BrianKramer at 2007-9-4 > top of Msdn Tech,Visual C++,Visual C++ Language...