Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

erroneous "set but not used" warnings with reference variables

Offen
#14,801 0 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
68/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
cpp
Bereich
devtools

Rechercherichtung

Reproduce the warning in a blank .cpp file using the reference-variable example, then inspect the linked diagnostic and language-server logs to locate the relevant analysis path. Done means the assignment through the reference is recognized as useful, with no set-but-unused warning or dimming.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Environment
  • OS and Version: Arch Linux (linux 7.2.6.arch2-1)
  • VS Code Version: 1.139.0 commit 2242ebbb54efeeb0129e08e919e7e8d43033cd83
  • C/C++ Extension Version: pre-release 1.35.2
  • If using SSH remote, specify OS of remote machine: N/A
Bug Summary and Steps to Reproduce

Bug Summary:

In the following code:

void modify(int& x){
    x = 3;
}

x is being erroneously marked as set-but-unused, even though the assignment can be useful.

Image

Steps to reproduce:

  1. Create a blank folder and a .cpp file with the content shown above in it
  2. Open the file
  3. See error

Expected behavior:
The variable is recognized as used and not dimmed, and there is no warning message on hover.

Configuration and Logs

c_cpp_properties.json: (none)

Log Diagnostics output

Language Server logging

Other Extensions

No response

Additional context

No response

Vorherrschende Sprache
TypeScript
Sterne
6.2k
Forks
1.7k
Ø Merge
18 Std. 16 Min.
Gemergte PRs (30 T.)
51

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus microsoft/vscode-cpptools

Alle Issues in microsoft/vscode-cpptools

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.