列挙型の前方宣言(C++11)
(列挙型の前方宣言(C++0x)から転送)
BCC32 には列挙型の前方宣言が導入されています。 列挙子のリストを指定しないで列挙型を宣言できます。 このような宣言は定義ではありません。固定のベース型の列挙に対してだけ使用できます。 列挙型は再び宣言できます。省略していた列挙子のリストを指定することもできますが、再宣言は前の宣言と一致する必要があります。 この機能は BCC32 に追加された C++11x 機能の 1 つです。
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: erent underlying type
enum class G; // illegal: erent underlying type
enum class H : short; // illegal: erent underlying type
enum class H {/* */}] // OK: this redeclaration is a definition