Bug: Spurious IntelliSense errors with C++20 Modules
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Quiet
- Tech stack
- cpp
- Domain
- developer-experience, tooling
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.
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
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 281
- PR merge metrics
- No merged PRs in 30d
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.
More from microsoft/cppwinrt
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 20/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
All issues in microsoft/cppwinrt
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·