diff options
| author | David Majnemer <david.majnemer@gmail.com> | 2015-10-08 07:45:35 +0000 |
|---|---|---|
| committer | David Majnemer <david.majnemer@gmail.com> | 2015-10-08 07:45:35 +0000 |
| commit | e4e3e6a5bf553841c9108b631a4170a3dac0d411 (patch) | |
| tree | fffe7ee6f96947ddfeb7bff8d7f5b810c27103e4 /clang/lib/Sema/SemaDecl.cpp | |
| parent | 5d3fbd373345ab902c3e0c47402f7b934e5bdbbc (diff) | |
| download | bcm5719-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.cpp | 6 |
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(); + } } } |

