Skip to content

clang-format-18 detachment from namespace #67907

Closed
@kalman5

Description

@kalman5

The following snippet

#include <functional>

namespace Short {
void foo() {}
} // namespace Short

namespace LongNameSpace {
void foo() {}
} // namespace LongNameSpace

struct Test {
  Test()
      : l([] {
          Short::foo();
          LongNameSpace::foo();
        }) {}

  std::function<void()> l;
};

formattted with clang-format-17 using the following configuration

Language: Cpp
AlignConsecutiveDeclarations: Consecutive

is formatted in the following way using clang-format-18

#include <functional>

namespace Short {
void foo() {}
} // namespace Short

namespace LongNameSpace {
void foo() {}
} // namespace LongNameSpace

struct Test {
  Test()
      : l([] {
          Short::        foo();
          LongNameSpace::foo();
        }) {}

  std::function<void()> l;
};

as you can see the the foo invoked from a shortnamespace is detached from it.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions