microsoft / microsoft/vscode-cpptools
False positive error on C nested structs
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 6.2k
- Fork
- 1.7k
- Merge medio
- 14h 46m
- PR unite (30g)
- 61
Descrizione
Type: Bug
VSCode claims that the assignment to foo.bar below is an error "a value of type "struct Bar" cannot be assigned to an entity of type "struct Bar" C/C++(513)"
The code compiles cleanly both with gcc and clang (with -Wall -Wextra in both cases). I believe it is ISO C compliant, although a fairly uncommon usage. (In C nested, named, structs become part of the global namespace, which is different from C++.)
// C not C++.
struct Foo {
struct Bar {
int x;
} bar;
};
int main(void)
{
struct Foo foo;
foo.bar = (struct Bar) {0}; // Incorrectly marked as an error by VSCode.
return foo.bar.x;
}
Extension version: 1.22.11
VS Code version: Code 1.95.3 (f1a4fb101478ce6ec82fe9627c43efbf9e98c813, 2024-11-13T14:50:04.152Z)
OS version: Linux x64 6.11.7-300.fc41.x86_64
Modes:
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz (8 x 3700) |
| 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: disabled_software vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: disabled_off webnn: disabled_off |
| Load (avg) | 1, 1, 1 |
| Memory (System) | 62.48GB (36.96GB free) |
| Process Argv | --crash-reporter-id 73c5a75d-b680-4906-94d8-412f0182e453 |
| Screen Reader | no |
| VM | 0% |
| DESKTOP_SESSION | mate |
| XDG_CURRENT_DESKTOP | MATE |
| XDG_SESSION_DESKTOP | mate |
| XDG_SESSION_TYPE | x11 |
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
2i9eh265:30646982
962ge761:30959799
pythonnoceb:30805159
asynctok:30898717
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
724cj586:31013169
dvdeprecation:31068756
dwnewjupytercf:31046870
2f103344:31071589
nativerepl2:31139839
pythonrstrctxt:31112756
cf971741:31144450
iacca1:31171482
notype1cf:31157160
5fd0e150:31155592
dwcopilot:31170013
stablechunks:31184530
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con la riproduzione minima in C della struct annidata presente nell’issue e analizza come l’estensione C/C++ analizza l’assegnazione a foo.bar. Confronta la diagnostica dell’estensione con i risultati di GCC e Clang. Il lavoro è completato quando il codice ISO C valido non produce alcun falso errore di incompatibilità dei tipi in VS Code, aggiungendo la copertura di regressione se il progetto fornisce una posizione di test adatta.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- c
- Ambito
- devtools
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 35/100