Issue 185005
Summary [clang-format] Unexpected lambda indentation with `LambdaBodyIndentation: OuterScope`
Labels clang-format
Assignees
Reporter zzag
    If a function takes a struct with `std::function`s, for example

```cpp
struct Options {
    std::function<void()> callback1;
 std::function<void()> callback2;
};

void foo(Options options) {
 ...
}
```

then the closing braces of lambdas will be unexpectedly indented.

The expected result:

```cpp
foo({
    .callback1 = []() {
 ...
    },
    .callback2 = []() {
        ...
 },
});
```

The actual result:

```cpp
foo({
    .callback1 = []() {
        ...
},
    .callback2 = []() {
 ...
},
});
```

Perhaps the braced initializer list should be treated as a new scope.

 clang-format version: 21.1.8
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to