diff options
-rw-r--r-- | lib/AST/ASTContext.cpp | 9 | ||||
-rw-r--r-- | test/Sema/function-redecl.c | 4 |
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 0c2cc1c617..3384601981 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -6413,10 +6413,13 @@ QualType ASTContext::mergeFunctionTypes(QualType lhs, QualType rhs, 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 + // Look at the converted 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 (const EnumType *Enum = argTy->getAs<EnumType>()) { + argTy = Enum->getDecl()->getIntegerType(); + if (argTy.isNull()) + return QualType(); + } if (argTy->isPromotableIntegerType() || getCanonicalType(argTy).getUnqualifiedType() == FloatTy) diff --git a/test/Sema/function-redecl.c b/test/Sema/function-redecl.c index 7076bdf3bd..ff8e003cd7 100644 --- a/test/Sema/function-redecl.c +++ b/test/Sema/function-redecl.c @@ -129,3 +129,7 @@ void test_x() { enum e0 {one}; void f3(); void f3(enum e0 x) {} + +enum incomplete_enum; +void f4(); // expected-note {{previous declaration is here}} +void f4(enum incomplete_enum); // expected-error {{conflicting types for 'f4'}} |