Skip to content

std::variant in a std::map declaration makes IntelliSense crash #5584

@etremel

Description

@etremel

Issue Type: Bug

Writing a brace-initializer list for a std::map whose values are std::variant types will cause IntelliSense to crash and cease providing suggestions or error squiggles for the entire file containing the initializer list. Even after deleting the offending declaration, IntelliSense will not work for the file that used to contain it until VS Code is restarted.

Steps to reproduce the problem:

  1. In VSCode with the C/C++ extension enabled, create a new cpp source file and enter the following code:
#include <map>
#include <variant>

struct Foo {
    int a;
};
struct Bar {
    int a;
    bool b;
};

int main(int argc, char** argv) {
    std::map<int, std::variant<Foo, Bar>> test = {
        {0, Foo{1}},
        {1, Bar{2, true}},
    };
    
    return 0;
}
  1. On the blank line before "return 0", type test.

    Expected result: An IntelliSense pop-up menu appears showing member functions of std::map as potential completions.

    Actual result: Nothing happens.

  2. Press enter, leaving the incomplete line of code test..

    Expected result: A red error squiggle underlines the invalid syntax.

    Actual result: Nothing happens.

Extension version: 0.28.1
VS Code version: Code 1.45.1 (5763d909d5f12fe19f215cbfdd29a91c0fa9208a, 2020-05-14T08:27:22.494Z)
OS version: Linux x64 4.15.0-100-generic snap

System Info
Item Value
CPUs Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz (8 x 2397)
GPU Status 2d_canvas: unavailable_software
flash_3d: disabled_software
flash_stage3d: disabled_software
flash_stage3d_baseline: disabled_software
gpu_compositing: disabled_software
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: disabled_off
rasterization: disabled_software
skia_renderer: disabled_off_ok
video_decode: disabled_software
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: unavailable_software
webgl2: unavailable_software
Load (avg) 0, 0, 0
Memory (System) 15.62GB (1.97GB free)
Process Argv --no-sandbox
Screen Reader no
VM 0%
DESKTOP_SESSION awesome-gnome
XDG_CURRENT_DESKTOP GNOME
XDG_SESSION_DESKTOP awesome-gnome
XDG_SESSION_TYPE x11

Metadata

Metadata

Assignees

No one assigned

    Labels

    Language ServiceVisual StudioInherited from Visual StudiobugfixedCheck the Milestone for the release in which the fix is or will be available.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions