microsoft / microsoft/cppwinrt
Bug: Spurious IntelliSense errors with C++20 Modules
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 281
- PR merge metrics
- No merged PRs in 30d
Description
Version
3.0.260715.1
Summary
A simple project that uses C++/WinRT with the new C++20 Modules feature can build successfully with MSVC 14.52 Preview in Visual Studio Insiders, but has IntelliSense errors in the IDE that get in the way of return type deduction and similar. For instance, the example code causes this IntelliSense error:
function "winrt::Windows::Foundation::IUnknown::operator new(size_t)" (declared at line 2117 of module "winrt_base" ("D:\...\winrtmodcom\x64\Debug\Generated Files\winrt\base.h")) cannot be referenced -- it is a deleted function
More likely than not, this is simply an IDE and IntelliSense bug and I've reported it as such in DevCom-11123562. Anyone who cares about this scenario is welcome to upvote it. Having said that, if there's any workaround that can be implemented on the cppwinrt side to mitigate these IntelliSense failures, it would be a welcome improvement to the user experience.
Reproducible example
import std;
import winrt_base;
import winrt.Windows.Foundation;
winrt::Windows::Foundation::IAsyncOperation<winrt::hstring> GetStringAsync()
{
co_return L"Hello, World!";
}
winrt::Windows::Foundation::IAsyncOperation<winrt::hstring> foo()
{
auto str = co_await GetStringAsync(); // IntelliSense labels this <error type> instead of figuring out it is a winrt::hstring.
co_return str;
}
Expected behavior
IntelliSense should be fully functional with cppwinrt C++20 Modules in scenarios that work correctly with header files.
Actual behavior
IntelliSense reports spurious E1776 errors and fails to deduce return types
Additional comments
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproducible C++20 Modules example using import std, import winrt_base, and import winrt.Windows.Foundation in Visual Studio Insiders with MSVC 14.52 Preview. Compare IntelliSense behavior against the equivalent header-based project and review the generated winrt\base.h mentioned in the error. Done means either identifying a cppwinrt-side workaround for the E1776 false positives or confirming that the issue must be resolved in DevCom-11123562.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100