| Issue |
109925
|
| Summary |
[clang-format] Regression in formatting of explicit NTTPs with bitwise operators.
|
| Labels |
clang-format
|
| Assignees |
|
| Reporter |
Jhuighuy
|
Hi everyone,
The latest released `clang-format` (19.1.0) cannot properly format nested calls, when the inner call contains explicit non-type template parameter expressions, containing bitwise operations. Expressions with arithmetic operations are formatted correctly.
`clang-format` 18 produces correct results.
The problem can be reproduced regardless of the presence or contents of `.clang-format`.
Example:
```sh
~ » cat a.cpp
void main() {
// Bitwise operations.
f(g<flag_1 | flag_2>());
f(g<flag_1 & flag_2>());
f(g<flag_1 ^ flag_2>());
f(g<flag_1 & ~flag_2>());
// Arithmetic operations.
f(g<flag_1 + flag_2>());
f(g<flag_1 - flag_2>());
f(g<flag_1 * flag_2>());
f(g<flag_1 / flag_2>());
}
~ » clang-format a.cpp
void main() {
// Bitwise operations.
f(g < flag_1 | flag_2 > ());
f(g < flag_1 & flag_2 > ());
f(g < flag_1 ^ flag_2 > ());
f(g < flag_1 & ~flag_2 > ());
// Arithmetic operations.
f(g<flag_1 + flag_2>());
f(g<flag_1 - flag_2>());
f(g<flag_1 * flag_2>());
f(g<flag_1 / flag_2>());
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs