| Issue |
75790
|
| Summary |
clang-format over-indents function after requires clause missing parentheses
|
| Labels |
clang-format
|
| Assignees |
|
| Reporter |
zmodem
|
Consider:
```
$ cat /tmp/a.cc
template <typename T> inline constexpr bool B = false;
template <typename T>
requires !B<T>
void g(T t) {}
$ build/bin/clang-format /tmp/a.cc
template <typename T> inline constexpr bool B = false;
template <typename T>
requires !B<T>
void g(T t) {}
```
Note the over-indent of `void g(...`.
It seems that parentheses are required to make the code valid:
```
$ build/bin/clang -c -std=c++20 /tmp/a.cc
/tmp/a.cc:3:10: error: parentheses are required around this _expression_ in a requires clause
3 | requires !B<T>
| ^~~~~
| ( )
1 error generated.
```
With the added parentheses, clang-format will do the right thing. If possible, it would be helpful it it handled the original code more gracefully, though.
(Originally from https://crbug.com/1511363)
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs