Skip to content

[clang-format] No space between between ) and { at constructor/destructor when there is a semicolon at the end. #79834

Closed
@CDAlexanderW

Description

@CDAlexanderW

Environment

The tested v18 clang-format executable was built from latest source of 15.01.2024.

Setting in .clang-format is:

Language: Cpp

Problem

No space between between ) and { at constructor/destructor when there is a semicolon at the end. A member function seems to work by adding the space, due to the fix #72733 in version 18.

class A {
  A(){};
  void b() {};
};

When adding something (in that case int i;) into the implementation, it seems to work for the constructor:

class A {
  ~A() { int i; };
  void s() { int i; };
};

It looks like #58251 mentions clang-format "cannot determine {} as an empty function".

For our case maybe a fix of #79833 would also workaround this in case you automatically let the semicolons removed. I don't know if they are related in some way, so I tried to split them into separate issues.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions