diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2012-08-30 00:44:15 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2012-08-30 00:44:15 +0000 |
commit | c586d5dd7a997321ea96d1d28213315f86778fc8 (patch) | |
tree | 0bd922cfdf95ac177d690a608da05b7c1b6f2c32 /lib/AST/ASTContext.cpp | |
parent | ecbbea47659c13ef4193879001f606868757007e (diff) |
Fix a crash in type merging with enum types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162886 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r-- | lib/AST/ASTContext.cpp | 9 |
1 files changed, 6 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) |