Issue 81822
Summary clang-format doesn't touch constructor format with braced initialization of base class and following member
Labels clang-format
Assignees
Reporter jacobsa
    If I have this input, with a badly formatted constructor for `Bar`:

```c++
int some_int_with_a_very_long_name;
int some_other_int_with_a_very_long_name;

struct Foo {
  explicit Foo(int, int);
};

struct Bar : Foo {
  Bar() : Foo{
 some_int_with_a_very_long_name,
 some_other_int_with_a_very_long_name,
              }, some_member(0) {}

  int some_member;
};
```

Then clang-format won't change it; it leaves it as is, no matter how it's formatted. It should be formatting it like this:

```c++
  Bar()
      : Foo{
 some_int_with_a_very_long_name,
 some_other_int_with_a_very_long_name,
        },
        some_member(0) {}
};
```

This would be consistent with what clang-format already does correctly do if the initializer for `some_member` isn't there:

```c++
  Bar()
      : Foo{
 some_int_with_a_very_long_name,
 some_other_int_with_a_very_long_name,
        } {}
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to