summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-10-08 07:45:35 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-10-08 07:45:35 +0000
commite4e3e6a5bf553841c9108b631a4170a3dac0d411 (patch)
treefffe7ee6f96947ddfeb7bff8d7f5b810c27103e4 /clang/lib/Sema/SemaDecl.cpp
parent5d3fbd373345ab902c3e0c47402f7b934e5bdbbc (diff)
downloadbcm5719-llvm-e4e3e6a5bf553841c9108b631a4170a3dac0d411.tar.gz
bcm5719-llvm-e4e3e6a5bf553841c9108b631a4170a3dac0d411.zip
[Sema] Tweak incomplete enum types on MSVC ABI targets
Enums without an explicit, fixed, underlying type are implicitly given a fixed 'int' type for ABI compatibility with MSVC. However, we can enforce the standard-mandated rules on these types as-if we didn't know this fact if the tag is not part of a definition. llvm-svn: 249667
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 23d4491d04c..fcc40955836 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -11769,8 +11769,10 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
EnumUnderlying = Context.IntTy.getTypePtr();
} else if (Context.getTargetInfo().getCXXABI().isMicrosoft()) {
- // Microsoft enums are always of int type.
- EnumUnderlying = Context.IntTy.getTypePtr();
+ if (getLangOpts().MSVCCompat || TUK == TUK_Definition) {
+ // Microsoft enums are always of int type.
+ EnumUnderlying = Context.IntTy.getTypePtr();
+ }
}
}
OpenPOWER on IntegriCloud