microsoft / microsoft/cppwinrt

Bug: Spurious IntelliSense errors with C++20 Modules

Aperta
#1,610 3 commenti 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
C++
Stelle
1.9k
Fork
281
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con l’esempio riproducibile di C++20 Modules usando import std, import winrt_base e import winrt.Windows.Foundation in Visual Studio Insiders con MSVC 14.52 Preview. Confronta il comportamento di IntelliSense con quello del progetto equivalente basato su header ed esamina il winrt\base.h generato menzionato nell’errore. Il lavoro è completato quando viene identificato un workaround lato cppwinrt per i falsi positivi E1776 oppure viene confermato che il problema deve essere risolto in DevCom-11123562.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp
Ambito
developer-experience, tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Da chiarire
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.