'How to fix Visual Studio co_await error / squiggle?

I get red squiggles and the error

E1776: function "winrt::impl::notify_awaiter<T>::notify_awaiter(const winrt::impl::notify_awaiter<winrt::Windows::Foundation::IAsyncAction> &) [with T=winrt::Windows::Foundation::IAsyncAction]" (declared implicitly) cannot be referenced -- it is a deleted function

wherever I use co_await in my C++/WinRT project.


Here is a picture of the squiggle, it happens on every co_await in the code:

enter image description here


I am using Visual Studio Enterprise 2022 (17.0.4) and compile the project with /std:c++latest. It compiles and runs fine!

Is that squiggle expected behavior? Can I fix the issue somehow?



Solution 1:[1]

co_await support has been landed in VS2022 and planned for VS2019 according to https://developercommunity2.visualstudio.com/t/declared-implicitly-cannot-be-referenc/1203236#TPIN-N10036664

  • Visual Studio 2022 version 17.2.0: ?
  • Visual Studio 2019 version 16.11.14: ?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sunbreak