Skip to content

Designated initializers squiggles #12239

@grishalipenko

Description

@grishalipenko

Environment

  • OS and Version: Ubuntu 23.10
  • VS Code Version: 1.88.1
  • C/C++ Extension Version: 1.19.9
  • If using SSH remote, specify OS of remote machine: no

Bug Summary and Steps to Reproduce

Unexpected errors with code using designated initializer https://en.cppreference.com/w/cpp/language/aggregate_initialization#Designated_initializers:

struct A
{
    explicit A() = default;
};

struct B
{
    A a;
    std::string str;
};

void foo()
{
    std::string_view other;
    [[maybe_unused]] B b{.a{}, .str{other}};
}

Designated1
Designated2

Configuration and Logs

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/clang++",
            "cStandard": "c17",
            "cppStandard": "c++20",
            "intelliSenseMode": "clang-x64",
            "compileCommands": "path/to/my/compile_commands.json"
        }
    ],
    "version": 4
}

Other Extensions

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

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

Type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions