Issue 173963
Summary [clang-format][c/c++] Incorrect formatting of `lhs * rhs` when result is not assigned to anything
Labels clang-format
Assignees
Reporter ViktorVoloshko
    Given the code
```c
int x = 0;
x*x; // Unused result
int y = x*x; // Used result
```
clang-format will format this as
```c
int x = 0;
x *x; // Unused result
int y = x * x; // Used result
```
Where `x*x` is formatted as `x (*ptr)`, which isn't even a valid _expression_.

Behavior is the same for C and C++. Behavior is correct with other arithmetic operators.

My .clang-format:
```yaml
BasedOnStyle: LLVM
InsertNewlineAtEOF: true
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to