Description
Example input:
$ cat /tmp/memberpointer.cpp
struct S;
void foo(const int S::*const ptr) {}
void bar(int const S::*const ptr) {}
Output:
$ ./clang-format --style="{QualifierAlignment: Right}" /tmp/memberpointer.cpp
struct S;
void foo(int const S::*const ptr) {}
void bar(int S::const *const ptr) {}
Discovered by running Clang-Format on an existing codebase that had a few instances of pointer to member function. The const
qualifier is moved iteratively until the code no longer compiles. Probably caused in this section
// The case `const Foo` -> `Foo const`
// The case `const ::Foo` -> `::Foo const`
// The case `const Foo *` -> `Foo const *`
// The case `const Foo &` -> `Foo const &`
// The case `const Foo &&` -> `Foo const &&`
// The case `const std::Foo &&` -> `std::Foo const &&`
// The case `const std::Foo<T> &&` -> `std::Foo<T> const &&`
while (Next && Next->isOneOf(tok::identifier, tok::coloncolon))
Next = Next->Next;
Where special treatment would be required for the following case, causing no change.
// The case `const Foo::*` -> `const Foo::*`
Metadata
Metadata
Assignees
Type
Projects
Status
Done