forward declare enums

Hi,

I’m working on an old codebase, it uses some (if not a lot) enum forward declarations like below.

struct MyStruct;
enum MyStruct::MyEnum;

the enum definition is like

struct MyStruct {
enum MyEnum { … };
};

The enum forward declaration seems working with the XCode4 and XCode5-DP, but it is reported as error when building with a trunk build of open source LLVM.

So should I understand Apple’s Clang is more tolerate than the open sourced Clang? or It just because such checks are added recently and not available in Xcode 5?

Thanks,

Yes, Clang previously had a bug where we failed to diagnose invalid out-of-life declarations of enums like this, and that bug persists in the Xcode 5 DP.

However, we only accepted such declarations after the definition of the struct, so this forward-declaration is always useless.

John.