[clang] [clang] Delay dependent co_return promise calls (PR #218779)
Kunal Dubey via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 2 19:46:30 PDT 2026
xakep8 wrote:
> My agent explains (haven't checked this explanation myself, only tested the repro is fine after reverting this change):
>
> ```
> In Sema::BuildCoreturnStmt, the new early return builds the CoreturnStmt and returns immediately, bypassing the full-expression handling below it. A temporary in the operand registers a cleanup that is then never consumed, so Cleanup.exprNeedsCleanups() is still set when the body finishes.
>
> Three ingredients, all required — dropping any one compiles clean:
> 1. type-dependent co_return operand → takes the new early-return path
> 2. a concrete temporary with a non-trivial destructor inside it → actually registers a cleanup
> 3. the coroutine is a member of a class template — a late-parsed inline method body. The same code as a free function template does not assert, which matches ParseLexedMethodDef in the stack.
> ```
https://github.com/llvm/llvm-project/pull/220234 the fix is on it's way.
https://github.com/llvm/llvm-project/pull/218779
More information about the cfe-commits
mailing list