enum X : long { Value = 0x100000000 };
when in Microsoft-extension mode (-fms-extensions). This (now C++0x)
feature has been supported since Microsoft Visual Studio .NET 2003.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126243
91177308-0d34-0410-b5e6-
96231b3b80d8
"missing ',' between enumerators">;
def err_enumerator_unnamed_no_def : Error<
"unnamed enumeration must be a definition">;
+def ext_ms_enum_fixed_underlying_type : Extension<
+ "enumeration types with a fixed underlying type are a Microsoft extension">,
+ InGroup<Microsoft>;
def ext_gnu_indirect_goto : Extension<
"use of GNU indirect-goto extension">, InGroup<GNU>;
}
}
- bool AllowFixedUnderlyingType = getLang().CPlusPlus0x;
+ bool AllowFixedUnderlyingType = getLang().CPlusPlus0x || getLang().Microsoft;
bool IsScopedEnum = false;
bool IsScopedUsingClassTag = false;
// Consume the ':'.
ConsumeToken();
- if (isCXXDeclarationSpecifier() != TPResult::True()) {
+ if ((getLang().CPlusPlus &&
+ isCXXDeclarationSpecifier() != TPResult::True()) ||
+ (!getLang().CPlusPlus && !isDeclarationSpecifier(true))) {
// We'll parse this as a bitfield later.
PossibleBitfield = true;
TPA.Revert();
if (!PossibleBitfield) {
SourceRange Range;
BaseType = ParseTypeName(&Range);
+
+ if (!getLang().CPlusPlus0x)
+ Diag(StartLoc, diag::ext_ms_enum_fixed_underlying_type)
+ << Range;
}
}
var.bad2; // expected-error {{no member named 'bad2' in 'struct test'}}
}
+// Enumeration types with a fixed underlying type.
+const int seventeen = 17;
+typedef int Int;
+
+struct X0 {
+ enum E1 : Int { SomeOtherValue } field; // expected-warning{{enumeration types with a fixed underlying type are a Microsoft extension}}
+ enum E1 : seventeen;
+};
+
+enum : long { // expected-warning{{enumeration types with a fixed underlying type are a Microsoft extension}}
+ SomeValue = 0x100000000
+};
f(0xffffffffffffffffLL);
f(0xffffffffffffffffi64);
}
+
+// Enumeration types with a fixed underlying type.
+const int seventeen = 17;
+typedef int Int;
+
+struct X0 {
+ enum E1 : Int { SomeOtherValue } field; // expected-warning{{enumeration types with a fixed underlying type are a Microsoft extension}}
+ enum E1 : seventeen;
+};
+
+enum : long { // expected-warning{{enumeration types with a fixed underlying type are a Microsoft extension}}
+ SomeValue = 0x100000000
+};