diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-02-03 19:27:29 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-02-03 19:27:29 +0000 |
commit | b0f8eacfdcd0d43f51e669f2d723992d4af9f746 (patch) | |
tree | abc417dba5d210737923d87c00140c46229c690d /lib/AST/ASTContext.cpp | |
parent | e78ccb4d609a113c3e06a9c4583e845e90b1a037 (diff) |
When determining whether a function without a prototype is compatible
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
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r-- | lib/AST/ASTContext.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 331932a458..46c5b41f93 100644 --- a/lib/AST/ASTContext.cpp +++ b/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(); |