Skip to content

[clang-format] odd line break with c-style comment in argument list #86573

Closed
@joelhock

Description

@joelhock

version 17.0.1 consistently keeps a c-style comment with its argument:

void func() {
  fooooooooooooooooooooooooooooooooooooooo(
      a,
      /*qqqq_=*/std::move(q), [this, b](std::function<void(uint32_t)> cb) {},
      c);
  fooooooooooooooooooooooooooooooooooooooo(
      /*qqqq_=*/std::move(q), [this, b](std::function<void(uint32_t)> cb) {});
  fooooooooooooooooooooooooooooooooooooooo(
      /*qqqq_=*/std::move(q), [this, b](std::function<void(uint32_t)> cb) {},
      c);
}

whereas 18.1 and HEAD (d99cfa0) in one narrow case decides to break after the comment (the last function call in this example):

void func() {
  fooooooooooooooooooooooooooooooooooooooo(
      a,
      /*qqqq_=*/std::move(q), [this, b](std::function<void(uint32_t)> cb) {},
      c);
  fooooooooooooooooooooooooooooooooooooooo(
      /*qqqq_=*/std::move(q), [this, b](std::function<void(uint32_t)> cb) {});
  fooooooooooooooooooooooooooooooooooooooo(
      /*qqqq_=*/
      std::move(q), [this, b](std::function<void(uint32_t)> cb) {}, c);
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions