Skip to content

Commit fc9fef2

Browse files
committed
[CS] Be more defensive in isIUOWrappedInParens() check
1 parent b32386b commit fc9fef2

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/Sema/ConstraintSystem.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2199,13 +2199,18 @@ void ConstraintSystem::resolveOverload(ConstraintLocator *locator,
21992199
if (!type || !type->is<AnyFunctionType>())
22002200
return false;
22012201

2202-
if (auto call = dyn_cast<CallExpr>(locator->getAnchor()))
2203-
return call->getSemanticFn() != call->getFn();
2202+
auto expr = locator->getAnchor();
2203+
if (!expr)
2204+
return false;
22042205

2205-
if (auto paren = getParentExpr(locator->getAnchor())) {
2206-
return isa<ParenExpr>(paren);
2206+
if (isa<CallExpr>(expr)) {
2207+
return false;
22072208
}
22082209

2210+
auto parentExpr = getParentExpr(expr);
2211+
if (parentExpr && isa<ParenExpr>(parentExpr))
2212+
return true;
2213+
22092214
return false;
22102215
};
22112216

0 commit comments

Comments
 (0)