microsoft / microsoft/vscode-cpptools

wrong type shown for reference captured by value.

Open
#9,753 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

void Fun(const int& i) {
	std::cout << &i << '\n';
	[=]() {
		std::cout << &i << '\n';
	}();
}

hover over the i symbol inside the lambda.
the tooltip shows the type as const int &i. this is incorrect, the type should be const int i, the outer reference is captured by value.

Extension version: 1.11.5
VS Code version: Code 1.70.2 (e4503b30fc78200f846c62cf8091b76ff5547662, 2022-08-16T05:35:13.448Z)
OS version: Windows_NT x64 10.0.19044
Modes:
Remote OS version: Linux x64 5.10.102.1-microsoft-standard-WSL2
Remote OS version: Linux x64 5.10.102.1-microsoft-standard-WSL2

System Info
Item Value
CPUs Intel(R) Core(TM) i5-9400 CPU @ 2.90GHz (6 x 2904)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
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_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 47.66GB (16.61GB free)
Process Argv
Screen Reader no
VM 31%
Item Value
Remote WSL: CentOS7
OS Linux x64 5.10.102.1-microsoft-standard-WSL2
CPUs Intel(R) Core(TM) i5-9400 CPU @ 2.90GHz (6 x 2904)
Memory (System) 37.34GB (21.18GB free)
VM 0%
Item Value
Remote WSL: CentOS7
OS Linux x64 5.10.102.1-microsoft-standard-WSL2
CPUs Intel(R) Core(TM) i5-9400 CPU @ 2.90GHz (6 x 2904)
Memory (System) 37.34GB (21.18GB free)
VM 0%

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

Start by reproducing the supplied C++ snippet in the Microsoft C/C++ extension and hovering over i inside the lambda. Trace the extension's hover/type-display handling for references captured by value; done means the tooltip shows the captured value type without the outer reference, while preserving the correct behavior outside the lambda.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.