summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/AST/ASTContext.cpp6
-rw-r--r--clang/test/Sema/function-redecl.c4
2 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 331932a4585..46c5b41f931 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -4330,6 +4330,12 @@ QualType ASTContext::mergeFunctionTypes(QualType lhs, QualType rhs) {
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();
diff --git a/clang/test/Sema/function-redecl.c b/clang/test/Sema/function-redecl.c
index 9544dc9baef..1302b34b107 100644
--- a/clang/test/Sema/function-redecl.c
+++ b/clang/test/Sema/function-redecl.c
@@ -125,3 +125,7 @@ void test_x() {
x(5);
x2(5); // expected-warning{{incompatible integer to pointer conversion passing 'int', expected 'int *'}}
}
+
+enum e0 {};
+void f3();
+void f3(enum e0 x) {}
OpenPOWER on IntegriCloud