forked from OSchip/llvm-project
Correctly skip type sugar when determining the width of an enum type. Derived
from a patch by Justin Bogner. llvm-svn: 192671
This commit is contained in:
parent
84342d69b0
commit
e952106164
|
@ -7478,7 +7478,7 @@ QualType ASTContext::mergeObjCGCQualifiers(QualType LHS, QualType RHS) {
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
unsigned ASTContext::getIntWidth(QualType T) const {
|
||||
if (const EnumType *ET = dyn_cast<EnumType>(T))
|
||||
if (const EnumType *ET = T->getAs<EnumType>())
|
||||
T = ET->getDecl()->getIntegerType();
|
||||
if (T->isBooleanType())
|
||||
return 1;
|
||||
|
|
|
@ -271,3 +271,14 @@ namespace PR16900 {
|
|||
enum class A;
|
||||
A f(A a) { return -a; } // expected-error {{invalid argument type 'PR16900::A' to unary expression}}
|
||||
}
|
||||
|
||||
namespace rdar15124329 {
|
||||
enum class B : bool { F, T };
|
||||
|
||||
const rdar15124329::B T1 = B::T;
|
||||
typedef B C; const C T2 = B::T;
|
||||
|
||||
static_assert(T1 != B::F, "");
|
||||
static_assert(T2 == B::T, "");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue