| Issue |
87035
|
| Summary |
[clang-format] weird formatting when template function name is `foreach`
|
| Labels |
clang-format
|
| Assignees |
|
| Reporter |
c8ef
|
- expected: https://godbolt.org/z/hqGE53fKW
```C++
#include <functional>
#include <iostream>
#include <string>
#include <vector>
template <typename Iter, typename Callable, typename... Args>
void foeach(Iter current, Iter end, Callable op, Args const &...args) {
while (current != end) {
std::invoke(op, args..., *current);
++current;
}
}
int main() {
std::vector<int> primes{2, 3, 5, 7, 11};
foeach(
primes.begin(), primes.end(),
[](std::string const &prefix, int i) {
std::cout << prefix << i << '\n';
},
"- value: ");
}
```
- unexpected: https://godbolt.org/z/5rzTTefKe
```C++
#include <functional>
#include <iostream>
#include <string>
#include <vector>
template <typename Iter, typename Callable, typename... Args>
void foreach (Iter current, Iter end, Callable op, Args const &...args) {
while (current != end) {
std::invoke(op, args..., *current);
++current;
}
}
int main() {
std::vector<int> primes{2, 3, 5, 7, 11};
foreach (
primes.begin(), primes.end(),
[](std::string const &prefix, int i) {
std::cout << prefix << i << '\n';
},
"- value: ")
;
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs