================ @@ -418,39 +448,60 @@ static ReadySuspendResumeResult buildCoawaitCalls(Sema &S, VarDecl *CoroPromise, return Calls; } Expr *CoroHandle = CoroHandleRes.get(); - CallExpr *AwaitSuspend = cast_or_null<CallExpr>( - BuildSubExpr(ACT::ACT_Suspend, "await_suspend", CoroHandle)); + auto *AwaitSuspend = [&]() -> CallExpr * { + auto *SubExpr = BuildSubExpr(ACT::ACT_Suspend, "await_suspend", CoroHandle); + if (!SubExpr) + return nullptr; + if (auto *E = dyn_cast<CXXBindTemporaryExpr>(SubExpr)) { + // This happens when await_suspend return type is not trivially + // destructible. This doesn't happen for the permitted return types of + // such function. Diagnose it later. + return cast_or_null<CallExpr>(E->getSubExpr()); + } else { + return cast_or_null<CallExpr>(SubExpr); + } ---------------- ChuanqiXu9 wrote:
Thanks. My motivation is that the small pattern match style looks really not good. And if it is possible to get the RecordDecl by the type of `Operand` and find the `await_suspend` member function? If yes, we can still get the location of `await_suspend`. And if we have problems printing `(have 'Status')` part, I feel it may not be a big problem since the underlying issue is clear. https://github.com/llvm/llvm-project/pull/85684 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits