Skip to content

[clang-format] Incorrect formatting when applying C-style cast to lambda expression #135959

@alumkal

Description

@alumkal

OS: Windows 11

Version: clang-format version 20.1.2

Example code:

int main() {
    auto foo { (std::function<int()>)[] { return 0; }};
    return 0;
}

After formatting:

int main() { auto foo{(std::function<int()>)[]{return 0; }
}
;
return 0;
}

auto foo = (std::function<int()>)[] { return 0; }; and auto foo { std::function<int()>([] { return 0; }) }; works as expected.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions