From 1d48a37c0e4741b5647916fd295ca784c73f5ca9 Mon Sep 17 00:00:00 2001 From: David Zarzycki Date: Fri, 14 Dec 2018 09:28:22 -0500 Subject: [PATCH] [Sema] ReturnStmt must be ImplicitConversionExpr aware Found while doing an unrelated experiment. --- lib/Sema/TypeCheckStmt.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/Sema/TypeCheckStmt.cpp b/lib/Sema/TypeCheckStmt.cpp index a47afb2b15bed..79de281475c44 100644 --- a/lib/Sema/TypeCheckStmt.cpp +++ b/lib/Sema/TypeCheckStmt.cpp @@ -471,6 +471,8 @@ class StmtChecker : public StmtVisitor { tryDiagnoseUnnecessaryCastOverOptionSet(TC.Context, E, ResultTy, DC->getParentModule()); } + while (auto ICE = dyn_cast(E)) + E = ICE->getSubExpr(); if (auto DRE = dyn_cast(E)) if (auto FD = dyn_cast(DRE->getDecl())) TC.addEscapingFunctionAsReturnValue(FD, RS);