diff --git a/strings/base_coroutine_foundation.h b/strings/base_coroutine_foundation.h index 797070737..84fe8bc81 100644 --- a/strings/base_coroutine_foundation.h +++ b/strings/base_coroutine_foundation.h @@ -305,7 +305,7 @@ namespace winrt::impl return *this; } - void operator()(Progress const& result) + void operator()(Progress const& result) const { m_promise->set_progress(result); } diff --git a/test/test/async_progress.cpp b/test/test/async_progress.cpp index 0a2790f50..a1ef121c8 100644 --- a/test/test/async_progress.cpp +++ b/test/test/async_progress.cpp @@ -19,8 +19,12 @@ namespace IAsyncOperationWithProgress Operation(HANDLE event) { co_await resume_on_signal(event); - auto progress = co_await get_progress_token(); - progress(123); + + // Invoke from a lambda to ensure that operator() is const. + [progress = co_await get_progress_token()]() + { + progress(123); + }(); co_return 1; }