Skip to content

[clang-format] PointerAlignment does not respect pointer to member field #85761

@CDAlexanderW

Description

@CDAlexanderW

Environment

The tested v19 clang-format executable was built from latest source of 13.03.2024. Also tested with clang-format 17.0.3.

Setting in .clang-format is:

Language: Cpp
PointerAlignment: Left
SpaceAroundPointerQualifiers: Before

Problem

class A {
public:
  int B;
};
void function(int A::* parameter, int* parameter2) {
  int A::* variable = &A::B;
  int* A::B;
}

formats to

class A {
public:
  int B;
};
void function(int A::*parameter, int* parameter2) {
  int A::*variable = &A::B;
  int* A::B;
}

For the pointers to member field we expect the space between the ::* and the variable/parameter name to be there and NOT removed.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions