diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-02-22 20:32:04 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-02-22 20:32:04 +0000 |
commit | 86f208c1a112c3e8984e63daec15ccf0a1a84329 (patch) | |
tree | 497fa5396dcd38f84883fb0d1af6cbe9308f0bb5 /lib/Parse/ParseDecl.cpp | |
parent | dc856aff4428380baa9afb5577ea04f8fb6beb13 (diff) |
Enable enumeration types with a fixed underlying type, e.g.,
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
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index d9c5069f59..2999fdf5d4 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -1975,7 +1975,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS, } } - bool AllowFixedUnderlyingType = getLang().CPlusPlus0x; + bool AllowFixedUnderlyingType = getLang().CPlusPlus0x || getLang().Microsoft; bool IsScopedEnum = false; bool IsScopedUsingClassTag = false; @@ -2047,7 +2047,9 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS, // 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(); @@ -2064,6 +2066,10 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS, if (!PossibleBitfield) { SourceRange Range; BaseType = ParseTypeName(&Range); + + if (!getLang().CPlusPlus0x) + Diag(StartLoc, diag::ext_ms_enum_fixed_underlying_type) + << Range; } } |