microsoft / microsoft/vscode-cpptools

Wrong name is underlined when trying to assign to a constant

Open
#14,018 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug Language Service Visual Studio
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Type: Bug

If I were to write something like this:

struct {
    const int i;
} s;
s.i = 0;

instead of underlining i to give the error like it should, it underlines s, when s isn't constant. If s was constant, this would be the correct behaviour.

Extension version: 1.28.3
VS Code version: Code 1.105.1 (7d842fb85a0275a4a8e4d7e040d2625abbf7f084, 2025-10-14T22:33:36.618Z)
OS version: Linux x64 6.8.0-86-generic
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz (8 x 2400)
GPU Status 2d_canvas: enabled
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
webnn: disabled_off
Load (avg) 2, 1, 1
Memory (System) 15.34GB (9.74GB free)
Process Argv --crash-reporter-id 3cdbf6ce-6d27-475a-ae69-ae7116a9bb80
Screen Reader no
VM 0%
DESKTOP_SESSION ubuntu
XDG_CURRENT_DESKTOP Unity
XDG_SESSION_DESKTOP ubuntu
XDG_SESSION_TYPE x11
A/B Experiments
vsliv368cf:30146710
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
aj953862:31281341
nes-set-on:31340697
6abeh943:31336334
aa_c:31379599
gendocstringf:31405073
0574c672:31404437
cloudbuttont:31379625
todos-1:31405332
qwen_all_req:31402696
treatment_gpt5applypatchexclusively:31398171
3efgi100_wstrepl:31403338
trigger-command-fix:31379601
auto_model_enabled:31385282
grok-v2-prompt:31401223
use-responses-api:31390855
applesignin:31399435
anonusage:31403420
ddidtcf:31399634
d5i5i512:31405346

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the diagnostic in VS Code with the C/C++ extension using the reported struct snippet and versions. Inspect which identifier receives the underline for the assignment to the const member; done means i is underlined while the non-const variable s is not.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, typescript
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.