microsoft / microsoft/vscode-cpptools
Type of array/vector incorrect in IntelliSense after a typedef and another array/vector
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
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.
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 C++ language service IntelliSense handling for typedefs and std::vector or array types, using the reproduction snippet in the issue. Verify the hover tooltip and Outline display for the function parameter, and consider the bug done when both report the correct element type without being affected by the preceding typedef and vector.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100