| Issue |
170573
|
| Summary |
clang-format regression formatting immediately invoked lambda
|
| Labels |
clang-format
|
| Assignees |
|
| Reporter |
aaron-skydio
|
I have an example ([this file](https://github.com/symforce-org/symforce/blob/d6afc27a54b219f6fe1b936e8cb276a0e7c2e895/gen/cpp/sym/factors/inverse_range_landmark_spherical_gnc_factor.h)) that I've trimmed down to this minimal example:
```cpp
void foo() {
const double _tmp327 = 1.0;
const double _tmp59 = 2.0;
const double _tmp339 = _tmp327 * [&]() {
const double base = _tmp59;
return base * base * base;
}();
}
```
Starting from LLVM 21.1.3 through LLVM 21.1.7, clang-format wants to format this as:
```cpp
void foo() {
const double _tmp327 = 1.0;
const double _tmp59 = 2.0;
const double _tmp339 = _tmp327* [&]() {
const double base = _tmp59;
return base * base * base;
}
();
}
```
which seems wrong.
Config is [here](https://github.com/symforce-org/symforce/blob/d6afc27a54b219f6fe1b936e8cb276a0e7c2e895/symforce/.clang-format).
Can reproduce by downloading the LLVM release binaries and running, for example,
```
❯ docker run --rm -it -v /home/aaron/symforce:/symforce ubuntu:noble /symforce/LLVM-21.1.3-Linux-X64/bin/clang-format
/symforce/gen/cpp/sym/factors/inverse_range_landmark_spherical_gnc_factor.h
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs