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
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index d9c5069..2999fdf 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -1975,7 +1975,7 @@
     }
   }
 
-  bool AllowFixedUnderlyingType = getLang().CPlusPlus0x;
+  bool AllowFixedUnderlyingType = getLang().CPlusPlus0x || getLang().Microsoft;
   bool IsScopedEnum = false;
   bool IsScopedUsingClassTag = false;
 
@@ -2047,7 +2047,9 @@
         // 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 @@
     if (!PossibleBitfield) {
       SourceRange Range;
       BaseType = ParseTypeName(&Range);
+      
+      if (!getLang().CPlusPlus0x)
+        Diag(StartLoc, diag::ext_ms_enum_fixed_underlying_type)
+          << Range;
     }
   }