[PATCH] D95244: [clang][AST] Handle overload callee type in CallExpr::getCallReturnType.

Balázs Kéri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 22 09:09:34 PST 2021


balazske created this revision.
Herald added subscribers: martong, gamesh411, Szelethus, dkrupp.
balazske requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Type of `Callee` can be overloaded function type that was not handled.
This causes a crash if the function is called in such case.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95244

Files:
  clang/lib/AST/Expr.cpp


Index: clang/lib/AST/Expr.cpp
===================================================================
--- clang/lib/AST/Expr.cpp
+++ clang/lib/AST/Expr.cpp
@@ -1392,6 +1392,11 @@
 
     // This should never be overloaded and so should never return null.
     CalleeType = Expr::findBoundMemberType(Callee);
+  } else if (CalleeType->isSpecificPlaceholderType(BuiltinType::Overload)) {
+    ASTContext::GetBuiltinTypeError Error;
+    QualType RetTy = Ctx.GetBuiltinType(BuiltinType::Dependent, Error);
+    assert(Error == ASTContext::GE_None);
+    return RetTy;
   }
 
   const FunctionType *FnType = CalleeType->castAs<FunctionType>();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95244.318543.patch
Type: text/x-patch
Size: 635 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210122/26ad238d/attachment.bin>


More information about the cfe-commits mailing list