Closed as duplicate of#142050
Closed as duplicate of#142050
Description
clang-format version 19.1.7
_clang-format:
BasedOnStyle: LLVM
AlignConsecutiveBitFields: AcrossEmptyLinesAndComments
myfile.hpp
:
template <int Bits>
struct ABC {
std::size_t fAName : Bits;
std::size_t fB : 1;
std::size_t fCOtherName : 63 - Bits;
};
Output:
>clang-format myfile.hpp
template <int Bits> struct ABC {
std::size_t fAName : Bits;
std::size_t fB : 1;
std::size_t fCOtherName : 63 - Bits;
};
In the output, the :
and Bits
on fAName
are not vertically aligned with the :
and bit field lengths on fB
and fCOtherName
.
Workaround: change fAName : Bits;
to fAName : 0 + Bits;
, which clang-format
then aligns properly.