mirror of https://github.com/microsoft/clang.git
[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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249667 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7006f5216c
commit
1d63a6b8d6
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 -triple %itanium_abi_triple -Wno-return-type -Wno-unused-value -emit-llvm %s -o - | FileCheck %s
|
||||
// RUN: %clang_cc1 -Wno-return-type -Wno-unused-value -emit-llvm %s -o - | FileCheck %s
|
||||
|
||||
// CHECK: @i = common global [[INT:i[0-9]+]] 0
|
||||
volatile int i, j, k;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 -triple %itanium_abi_triple -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 -Wc++14-compat %s
|
||||
// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 -Wc++14-compat %s
|
||||
|
||||
// Need std::initializer_list
|
||||
namespace std {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only %s -verify
|
||||
// RUN: %clang_cc1 -fsyntax-only %s -verify
|
||||
// PR5692
|
||||
|
||||
enum x; // expected-note {{forward declaration}}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -verify %s
|
||||
// RUN: %clang_cc1 -triple %ms_abi_triple -fsyntax-only -verify %s
|
||||
|
||||
const int AA = 5;
|
||||
|
||||
|
|
Loading…
Reference in New Issue