microsoft / microsoft/vscode-cpptools
IntelliSense hover and inlay hints incorrect reports type "unnamed" instead of "const float&"
Open
Nobody has claimed this yet.
bug
Feature: Hover (Quick Info)
Feature: Inlay Hint
Language Service
Visual Studio
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Repro code is
#include <array>
template <std::size_t N>
constexpr auto transform(const std::array<float, N>& arr)
{
std::array<int, N> values;
for (std::size_t i{0}; const auto& k : arr)
{
static_assert(std::is_same_v<decltype(k), const float&>);
constexpr auto j = 0;
values[j] = k; // change this j to i and you get a different error as well
++i;
}
return values;
}
int main()
{
constexpr auto values = transform(std::array{0.f});
}
using C++ 20. Based on the repro in https://github.com/microsoft/vscode-cpptools/issues/8673 .
VS screenshot:
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 by running the supplied C++20 repro in the VS Code C/C++ extension and inspect the hover and inlay-hint output for k, especially the reported "unnamed" type. Compare it with the expected const float& type and the differing diagnostic when j is changed to i; done means both reports and diagnostics are correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100