Skip to content

Subject: clang-format 21 regression when using "AlignConsecutiveDeclarations: Consecutive" #160513

@JohnC32

Description

@JohnC32

Running clang-format 21.1.1 on the following which was indented using clang-format 19:

void MyClass::operator()() {
    namespace1::util::scope_guard const markExecuted([this] { isExecuted_ = true; });
    SomeAPI::operator()();
}

using _clang-format:

---
BasedOnStyle: Google
IndentWidth: 4
ColumnLimit: 100
AlignConsecutiveDeclarations: Consecutive
...

results in the incorrect splitting of "SomeAPI::" from the "operator()();"

void MyClass::operator()() {
    namespace1::util::scope_guard const markExecuted([this] { isExecuted_ = true; });
    SomeAPI::                           operator()();
}

clang-format 19 does not do this splitting.

Note, I'm upgrading from clang-format 19 to 21 and I did not try 20, so not sure when the behavior regressed.

Metadata

Metadata

Assignees

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions