[PATCH] D26057: [coroutines] Add DependentCoawaitExpr and fix re-building CoroutineBodyStmt.

Richard Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 6 15:48:44 PST 2017


rsmith added inline comments.


================
Comment at: lib/Sema/TreeTransform.h:6802
+  return getDerived().RebuildDependentCoawaitExpr(
+      E->getKeywordLoc(), Result.get(), E->getOperatorCoawaitLookup());
+}
----------------
EricWF wrote:
> rsmith wrote:
> > You need to transform the UnresolvedLookupExpr here too. (Example: we might have a function-local declaration of `operator co_await` that needs to be transformed into the version in the instantiated function.)
> Ack. Fixed.
> 
> Do you have an example that doesn't use a function-local definition? Since `operator co_await` cannot be defined locally.
It can't be defined locally, but it can be *declared* locally. Example:

```
template<typename T> future<void> f(T t) {
  future<void> operator co_await(T);
  co_await t;
}
struct X {};
auto x = f(X{});
```

... which would require that `future<void> operator co_await(X)` is defined somewhere in the program.


https://reviews.llvm.org/D26057





More information about the cfe-commits mailing list