summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-02-03 19:27:29 +0000
committerDouglas Gregor <dgregor@apple.com>2010-02-03 19:27:29 +0000
commit2973d406ba2616e31a6e7635c44c852ab3e08d4d (patch)
tree476d53a7382eb25b10e97136f56c2d657a47e8b8 /clang/lib/AST/ASTContext.cpp
parent099552a0ca16d720c10802c00a54d52a9a2264ed (diff)
downloadbcm5719-llvm-2973d406ba2616e31a6e7635c44c852ab3e08d4d.tar.gz
bcm5719-llvm-2973d406ba2616e31a6e7635c44c852ab3e08d4d.zip
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. llvm-svn: 95238
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r--clang/lib/AST/ASTContext.cpp6
1 files changed, 6 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();
OpenPOWER on IntegriCloud