[PATCH] D115187: [clangd] Expose CoawaitExpr's operand in the AST

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 25 03:09:06 PDT 2022


sammccall added a comment.

In D115187#3471003 <https://reviews.llvm.org/D115187#3471003>, @nridge wrote:

> Without my patch, this compiles fine. With it, I clang gives the following errors:
>
>   coroutines.cpp:35:9: error: no viable conversion from 'awaitable' to 'transform_awaitable'
>   coro<T> await_template(U t) {
>           ^~~~~~~~~~~~~~
>   coroutines.cpp:39:34: note: in instantiation of function template specialization 'await_template<transform_promise, transform_awaitable>' requested here
>   template coro<transform_promise> await_template<transform_promise>(transform_awaitable);

Poked at this a bit locally.
>From the message we see there's a call to `BuildUnresolvedCoawaitExpr` with an `awaitable` rather than `transform_awaitable`, so the `await_transform` call fails.

It turns out this is the `initial_suspend` call (CXXMemberCallExpr). We're not supposed to <https://eel.is/c++draft/expr.await#3.2> transform initial/final suspends, but the code is now doing so.

This seems to be a consequence of switching from BuildResolvedCoawaitExpr (which does not apply the transform) to BuildUnresolvedCoawaitExpr (which does) during template instantiation.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115187/new/

https://reviews.llvm.org/D115187



More information about the cfe-commits mailing list