microsoft / microsoft/vscode-cpptools
Type of array/vector incorrect in IntelliSense after a typedef and another array/vector
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 6.2k
- Forks
- 1.7k
- Ø Merge
- 14 Std. 46 Min.
- Gemergte PRs (30 T.)
- 61
Beschreibung
Bug type: Language Service
Describe the bug
- OS and Version: Windows 11 Pro
- VS Code Version: 1.57.1
- C/C++ Extension Version: 1.5.0-insiders3
In some cases the type of the elements of anarray/vectoris incorrect in IntelliSense after atypedefand anotherarray/vector.
Steps to reproduce
- Paste the following code into a cpp file:
#include <vector>
typedef int my_type;
std::vector<my_type> v;
void f(std::vector<int> x) {}
- Hover over the
f(orx). - The tooltip says
xis astd::vector<my_type>. - Notice how under Outline it is displayed as
std::vector<float>.
Expected behavior
x should be a std::vector<float>.
A more general way to reproduce this is:
- Define a new type:
typedef <existing_type> <new_type>; - Define an
array/vectorof<new_type>. - Define a function/variable that is/has an
array/vectorof<existing_type>. - IntelliSense will tell it is an
array/vectorof<new_type>.
Screenshots


Additional context
Visual Studio 2019 seems to have the same issue.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit der IntelliSense-Verarbeitung des C++ language service für typedefs sowie std::vector- oder Array-Typen und verwende das Reproduktions-Snippet im Issue. Überprüfe den Hover-Tooltip und die Outline-Anzeige für den Funktionsparameter und betrachte den Bug als behoben, wenn beide den korrekten Elementtyp melden, ohne durch das vorangestellte typedef und den vorangestellten vector beeinflusst zu werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- cpp
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100