with a function with a prototype, treat parameters of enumeration type
based on the enumeration type's promotion type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95238
91177308-0d34-0410-b5e6-
96231b3b80d8
unsigned proto_nargs = proto->getNumArgs();
for (unsigned i = 0; i < proto_nargs; ++i) {
QualType argTy = proto->getArgType(i);
+
+ // Look at the promotion type of enum types, since that is the type used
+ // to pass enum values.
+ if (const EnumType *Enum = argTy->getAs<EnumType>())
+ argTy = Enum->getDecl()->getPromotionType();
+
if (argTy->isPromotableIntegerType() ||
getCanonicalType(argTy).getUnqualifiedType() == FloatTy)
return QualType();
x(5);
x2(5); // expected-warning{{incompatible integer to pointer conversion passing 'int', expected 'int *'}}
}
+
+enum e0 {};
+void f3();
+void f3(enum e0 x) {}