than the enumeration type itself takes. Fixes PR7477.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107163
91177308-0d34-0410-b5e6-
96231b3b80d8
llvm::APSInt Val = (*EDI)->getInitVal();
if(Val.getBitWidth() < CondWidth)
Val.extend(CondWidth);
+ else if (Val.getBitWidth() > CondWidth)
+ Val.trunc(CondWidth);
Val.setIsSigned(CondIsSigned);
EnumVals.push_back(std::make_pair(Val, (*EDI)));
}
--- /dev/null
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// PR7477
+enum __attribute__((packed)) E {
+ Ea, Eb, Ec, Ed
+};
+
+void test_E(enum E e) {
+ switch (e) {
+ case Ea:
+ case Eb:
+ case Ec:
+ case Ed:
+ break;
+ }
+}