microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.54k stars 1.56k forks source link

A value of type X cannot be used to initialize an entity of type X #7837

Closed comiluv closed 3 years ago

comiluv commented 3 years ago

Issue Type: Bug Looks related to https://github.com/microsoft/vscode-cpptools/issues/3212

  1. Create a new document
  2. Select language to be C
  3. Type:
    
    struct s {
    int dummy;
    char somechar[8];
    } array_of_s[10];

void f(void) { struct s a = array_of_s[0]; // this line gives me an error message }

int main(void) { f(); return 0; }

4. Error message says ```a value of type "struct s" cannot be assigned to an entity of type "struct s"C/C++(513)```
<img width="719" alt="화면 캡처 2021-07-17 085455" src="https://user-images.githubusercontent.com/19642705/126018779-05d9a5fe-7937-4fb0-adf3-007a844405e7.png">

5. The file compiles fine using gcc, no error

Extension version: 1.5.1
VS Code version: Code 1.58.2 (c3f126316369cd610563c75b1b1725e0679adfb3, 2021-07-14T22:10:15.214Z)
OS version: Windows_NT x64 10.0.19043
Restricted Mode: No

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i9-10850K CPU @ 3.60GHz (20 x 3600)|
|GPU Status|2d_canvas: enabled<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>oop_rasterization: enabled<br>opengl: enabled_on<br>rasterization: enabled<br>skia_renderer: enabled_on<br>video_decode: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled|
|Load (avg)|undefined|
|Memory (System)|63.87GB (55.01GB free)|
|Process Argv|--crash-reporter-id bbfbb75b-5e28-4eaa-87a7-7cf239f2c4c2|
|Screen Reader|no|
|VM|0%|
</details><details>
<summary>A/B Experiments</summary>

vsliv368:30146709 vsreu685:30147344 python383cf:30185419 pythonvspyt700cf:30270857 pythonvspyt602:30300191 vspor879:30202332 vspor708:30202333 vspor363:30204092 pythonvspyt639:30300192 pythontb:30283811 pythonvspyt551cf:30311713 vspre833:30321513 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 pythondataviewer:30285071 vscus158:30321503 pythonvsuse255:30335481 vscod805cf:30301675 pythonvspyt200cf:30331938 vscextlangct:30333562 binariesv615:30325510 vsccppwtct:30329789 bridge0708:30335490



</details>

<!-- generated by issue reporter -->
Colengms commented 3 years ago

Hi @comiluv . Thanks for reporting this. I can reproduce the issue. I can also repro in VS, but only after an edit within the definition of f().

sean-mcmanus commented 3 years ago

@Colengms Did you file an internal bug yet? I don't see one.

Colengms commented 3 years ago

I've opened a bug internally, against components shared with VS.

Colengms commented 3 years ago

Hi @comiluv . It looks like this no longer repro's, starting with 1.6.0. Closing. If you are still able to repro this issue, please let us know.