From: Douglas Gregor Date: Thu, 8 Sep 2011 23:29:05 +0000 (+0000) Subject: The integer type of an enumeration type isn't always canonical X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=69ff26bd1e7a2faffec0c3b9740cfb0c6bb354c5;p=clang The integer type of an enumeration type isn't always canonical git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139334 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index aec90bd9ce..b1a87a83dc 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -2597,7 +2597,7 @@ struct IntRange { if (const ComplexType *CT = dyn_cast(T)) T = CT->getElementType().getTypePtr(); if (const EnumType *ET = dyn_cast(T)) - T = ET->getDecl()->getIntegerType().getTypePtr(); + T = C.getCanonicalType(ET->getDecl()->getIntegerType()).getTypePtr(); const BuiltinType *BT = cast(T); assert(BT->isInteger()); diff --git a/test/SemaObjC/enum-fixed-type.m b/test/SemaObjC/enum-fixed-type.m index 0ec8db476c..530ee0fe99 100644 --- a/test/SemaObjC/enum-fixed-type.m +++ b/test/SemaObjC/enum-fixed-type.m @@ -20,3 +20,8 @@ struct X { enum Other : Integer field3 : 4; enum : Integer { Blah, Blarg } field4 : 4; }; + +void test() { + long value = 2; + Enumeration e = value; +}