microsoft / microsoft/vscode-cpptools

multi-argument operator[] breaks intellisense

Open
#13,407 1 comment 0 reactions 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

multi-argument operator[] breaks intellisense. e.g.

template<class T, int N, int M>
struct mat {
    T a[N][M];

    T &operator[](int i, int j) { return a[i][j]; }
};
mat4 f;
    print(f[0, 0]);

causes a red squiggle with description

no operator "[]" matches these operandsC/C++(349)
main.cpp(20, 12): operand types are: mat4 [ int ]
main.cpp(20, 12): built-in operator[](, <ptrdiff_t>) does not match because argument #1 does not match parameter
main.cpp(20, 12): built-in operator[](<ptrdiff_t>, ) does not match because argument #1 does not match parameter

Extension version: 1.23.6
VS Code version: Code 1.98.2 (ddc367ed5c8936efe395cffeec279b04ffd7db78, 2025-03-12T13:32:45.399Z)
OS version: Windows_NT x64 10.0.19045
Modes: Unsupported

System Info
Item Value
CPUs 12th Gen Intel(R) Core(TM) i9-12900K (24 x 3187)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
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
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 63.75GB (47.06GB free)
Process Argv --crash-reporter-id 280fe042-c548-46f7-a820-a3a3af7da63e
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
2e7ec940:31000449
pythontbext0:30879054
cppperfnew:31000557
dwnewjupytercf:31046870
nativerepl1:31139838
pythonrstrctxt:31112756
nativeloc1:31192215
iacca1:31171482
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
hdaa2157:31222309
copilot_t_ci:31222730
850i5325:31264362
968h8231:31262364
jda6j935:31233686
pythoneinst12:31262605
bgcontrol:31262794
fh1c7952:31258891
31787653:31262186
793h1473:31266633
80860236:31264450
49da9784:31264548

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 issue using the provided C++ mat example and the C/C++ extension in VS Code. Trace how IntelliSense handles a multi-argument operator[] and verify completion and diagnostics for f[0, 0]; done means the expression no longer shows the reported red squiggle or operator mismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, typescript, vscode
Domain
devtools, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.