Skip to content

Intellisense gives error messages when using structured binding #2597

@lanyizi

Description

@lanyizi

Type: LanguageService

  • OS and Version: Windows 10 1803
  • VS Code Version: 1.27.2
  • C/C++ Extension Version: 0.19.0
  • Other extensions you installed (and if the issue persists after disabling them): None

Intellisense giving std::tuple_size<"const [Type name]">::value is not a valid integral constant-expression when there isn't actually any code wrong.

To Reproduce
For example this code will induce Intellisense to report an error:

struct Test{
    int a;
    int b;
};
Test test{0, 0};
const auto [a, b] = test;

Now in the "Problems" tab following error message will appear:
std::tuple_size<"const Test">::value is not a valid integral constant-expression

Screenshots
image

My configuration:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.17134.0",
            "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx64/x64/cl.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "msvc-x64"
        }
    ],
    "version": 4
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Language ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.parser

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions