Skip to content

clang-format: QualifierAlignment doesn't work with all-caps namespace #145388

@mathcounts4

Description

@mathcounts4

clang-format version 19.1.7

_clang-format:

BasedOnStyle: LLVM
QualifierAlignment: Right

myfile.hpp:

namespace CAPS {
	struct InCaps {};
}

namespace lowercase {
	struct InLowercase {};
}

void use(const CAPS::InCaps &, const lowercase::InLowercase &);

QualifierAlignment: Right = east const should change the declaration of use to:

void use(CAPS::InCaps const &, lowercase::InLowercase const &);

but clang-format mishandles the CAPS namespace (and any namespace that is all capital letters), and only modifies the second argument, producing:

void use(const CAPS::InCaps &, lowercase::InLowercase const &);

Output:

>clang-format myfile.hpp
namespace CAPS {
struct InCaps {};
} // namespace CAPS

namespace lowercase {
struct InLowercase {};
} // namespace lowercase

void use(const CAPS::InCaps &, lowercase::InLowercase const &);

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions