================ @@ -115,3 +115,18 @@ CoNoCRT<int> bar(int a) { co_return 1; } } // namespace not_a_crt + +// ============================================================================= +// Not lifetime bound coroutine wrappers: [[clang::coro_not_lifetimebound]]. +// ============================================================================= +namespace not_lifetimebound { +Co<int> foo(int x) { co_return x; } + +[[clang::coro_wrapper, clang::coro_not_lifetimebound]] +Co<int> foo_wrapper(const int& x) { return foo(x); } + +[[clang::coro_wrapper]] Co<int> caller() { + // The call to foo_wrapper is wrapper is safe. + return foo_wrapper(1); +} +} // namespace not_lifetimebound ---------------- ilya-biryukov wrote:
NIT: add newline https://github.com/llvm/llvm-project/pull/76818 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits