Issue 97240
Summary [clang-format] strange formatting for trailing member function call after aggregate initialization
Labels clang-format
Assignees
Reporter jacobsa
    clang-format provides strange formatting for an _expression_ that involves a member function call on an rvalue constructed with aggregate initialization. For example:

```c++
return MyStruct{
    foo,
    bar,
 baz,
}
    .some_method();
```

The indentation of the trailing method call compared to the initializers and the closing brace is surprising. Compare this with what you get with the parenthesized version, even if you force one line per constructor argument:

```c++
return MyStruct(  //
           foo,   //
           bar,   //
 baz)
    .some_method();
```

On that analogy I would expect something more like this:

```c++
return MyStruct{
 foo,
           bar,
           baz,
       }
 .some_method();
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to