Index: lib/Sema/SemaDecl.cpp =================================================================== --- lib/Sema/SemaDecl.cpp +++ lib/Sema/SemaDecl.cpp @@ -14351,7 +14351,13 @@ // we perform a non-narrowing conversion as part of converted constant // expression checking. if (!isRepresentableIntegerValue(Context, EnumVal, EltTy)) { - if (getLangOpts().MSVCCompat) { + if (getLangOpts().MSVCCompat || + Context.getTargetInfo().getCXXABI().isMicrosoft()) { + // Treat as an extension in MSVC compat mode or if using the + // MSVC ABI. We already treat the equivalent case in C as an + // extension if we're not in Microsoft mode. Several Windows + // headers define enums with initializers like 0x80000000 and + // 0xffffffff. Diag(IdLoc, diag::ext_enumerator_too_large) << EltTy; Val = ImpCastExprToType(Val, EltTy, CK_IntegralCast).get(); } else