Find All References on a variable template returns nothing
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 62/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- cpp, typescript
Research direction
Start with P1-var-template-zeroValue.zip and inspect src/extras.h:22 and the uses in main.cpp:150-151. Trace the textDocument/references handling for the variable-template symbol and compare the reported result with the expected three references. Done means Find All References returns the declaration and both instantiation uses.
Written by the indexing model from the issue text.
Description
Environment
cpptools — Find All References on the variable template ex::zeroValue returns nothing
| Field | Value |
|---|---|
| Symbol (spec id) | var-template-zeroValue |
| Declaration | template <class T> constexpr T zeroValue = T(0); (variable template) |
| Query position | src/extras.h:22:13 (cursor on zeroValue) |
| Affected LSP request | textDocument/references |
| Repro archive | P1-var-template-zeroValue.zip (this folder) |
Summary
Find All References on the variable template ex::zeroValue returns no references in VS Code with the C/C++ extension (cpptools), missing both instantiation uses. The symbol appears unused even though it is instantiated twice.
Environment
- Editor: Visual Studio Code 1.33.5
- Extension: C/C++ (
ms-vscode.cpptools), default IntelliSense engine - Language standard: C++20 (freestanding fixture; no STL/toolchain required)
Steps to reproduce
- Extract
P1-var-template-zeroValue.zipand open thecpp-projectfolder in VS Code (C/C++ extension enabled). - Optionally configure with CMake Tools (preset
cdb); the fixture also parses under default C++20 IntelliSense. - Open
src/extras.h, place the cursor onzeroValueinconstexpr T zeroValue = T(0);(line 22, col 13). - Invoke Find All References (
Shift+Alt+F12).
Expected vs actual
| Source | Result count |
|---|---|
| Expected | 3 |
| VS Code / cpptools | 0 (no references) |
Expected (3): the template declaration (extras.h:22) and its two instantiation uses in main() — ex::zeroValue<int> (main.cpp:150) and ex::zeroValue<double> (main.cpp:151).
Actual (0): "Find All References" reports no results (the instantiation uses are not found).
Why it matters
A false "no references" on a live symbol is high risk: an automated agent (or a developer) can conclude the variable template is dead and delete it, breaking the two instantiations.
Bug Summary and Steps to Reproduce
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 58
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/vscode-cpptools
-
bug Language Service regression
microsoft/vscode-cpptools#14795 · 1 comment · 1 assignee ·
-
bug Language Service parser
microsoft/vscode-cpptools#14794 · 1 comment · 1 assignee ·
-
more info needed
microsoft/vscode-cpptools#14793 · 2 comments · 1 assignee ·
-
more info needed
Difficulty 4/5 3-5 days Newbie friendliness 35/100
microsoft/vscode-cpptools#14787 · 1 comment · 1 assignee ·
-
[Bug] cpptools fails to start on Ubuntu ARM64 due to missing execute permissions on shared libraries Openbug fixed Language Service regression
microsoft/vscode-cpptools#14779 · 1 comment · 1 assignee ·
All issues in microsoft/vscode-cpptools
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
vercel-labs/just-bash#464 ·
-
looksLikeSlug() is ASCII-only, so non-Latin entity slugs (e.g. Korean) skip exact match and collapse Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
TanStack/tanstack.com#1293 ·