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 | a1aec29a2d09edcc8ef487eddef289e7e6842f16 (patch) | |
tree | 67447de84cb61e1f2c6e5c65539c39e9068cefba /clang/lib/Parse/ParseDecl.cpp | |
parent | 7a24210ebdcefc1446369ec98f4209a93353335e (diff) | |
download | bcm5719-llvm-a1aec29a2d09edcc8ef487eddef289e7e6842f16.tar.gz bcm5719-llvm-a1aec29a2d09edcc8ef487eddef289e7e6842f16.zip |
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.
llvm-svn: 126243
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index d9c5069f598..2999fdf5d4b 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/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; } } |