Hi there
This is some really strange problem I just noticed.
Try compiling this class which creates a default instance and has a function with an enum-type argument with default value:
MyClass.h
#pragma once
enum MyEnum {EN_1};
class MyClass
{
void foo(MyEnum e = EN_1) {}
void bar(int e = 345) {}
} extern myClassInstance;
MyClass.cpp
#include "MyClass.h"
MyClass myClassInstance;
The compiler will complain about "myClassInstance" having no type (and says it can't assume default-int). Obviously, the class declaration somehow get messed up in a way that doesn't allow the declaration of instances right at the end anymore.
This appears to be caused by the default argument for foo(). If you remove the default enum argument ("= EN_1"), it'll compile fine. The default int argument works without problems... It also works if I declare the instance normally, not external, but I don't want that.
The way around this issue is as simple as declaring the external instance after the class declaration. Like:
class MyClass {... };
extern MyClass myClassInstance;
But that shouldn't be necessary, should it? What do you think?
I guess that's an msvc compiler bug. Where to report these?
Oh, and btw. I noticed there's already a SP1 for msvc 2008 express. Do I have to download that update myself somewhere or did M$ update take care of it? I'm not quite sure if it's already installed, the info dialog says "Version 9.0.xxxxxx... SP", but not SP1