Skip to content

Intellisense not interpreting C++17 auto correctly #2112

@jeffbi

Description

@jeffbi

Type: LanguageService

  • OS and Version: Linux Mint 64-bit
  • VS Code Version: 1.24.0
  • C/C++ Extension Version: 0.17.4

Intellisense interprets the construct auto p{"Fred"} as deduction of an initializer list. In C++17 that should not be the case.

To Reproduce
Use the following C++17 main.cpp file:

int main()
{
    auto s = "fred";
    auto p{s};
}

along with the following (auto-generated) c_cpp_properties.json file:

{
    "configurations": [
        {
            "name": "Linux",
            "browse": {
                "path": [
                    "${workspaceFolder}"
                ],
                "limitSymbolsToIncludedHeaders": true
            },
            "includePath": [
                "${workspaceFolder}"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64"
        }
    ],
    "version": 4
}

Red squiggles appear under auto p. Intellisense is seeing this line as a deduction of an initializer list.

Expected behavior
auto p{s} should be recognized as p being a const char *.

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
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions