Forward Declaration of Enums (C++11)
Go Up to C++11 Features in the Classic Compiler
Attention: This page refers to a C++11 feature in the Classic compiler. The Classic compiler is not recommended: instead it is recommend you use the Clang-enhanced compilers, which support modern C++ including C++11, C++14 and C++17.
BCC32 introduces forward declaration of enums. You can declare an enumeration without providing a list of enumerators. Such declarations would not be definitions and can be provided only for enumerations with fixed underlying types. An enumeration can then be re-declared, possibly providing the missing list of enumerators, but the re-declaration must match the previous declaration. This feature is one of the C++11 features added to BCC32.
enum E : short; // OK: unscoped, underlying type is short enum F: // illegal: enum-base is required enum class G : short // OK: scoped, underlying type is short enum class H; // OK: scoped, underlying type is int enum E : short; // OK: redeclaration of E enum class G : short; // OK: redeclaration of G enum class H; // OK: redeclaration of H enum class H : int; // OK: redeclaration of H enum class E : short; // illegal: previously declared as unscoped enum G : short; // illegal: previously declared as scoped enum E; // illegal: enum-base is required enum E : int // illegal: different underlying type enum class G; // illegal: different underlying type enum class H : short; // illegal: different underlying type enum class H {/* */}] // OK: this redeclaration is a definition