<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>I have the following bit of code (or something very similar):</div><div><br></div><div>int main() {<br> add_thingie({{Thingie1::ID(), (ThingieHandler)[=](const Object& o) { do_something1(o); }}, {Thingie2::ID(), (ThingieHandler)[=](const Object& o) { do_something2(o); }}});<br> return 0;<br>}</div><div><br></div><div>If I run it through clang-format (6.0.0), I get the following output.</div><br>C:\clang-format_example>clang-format example_bad.cpp<br>int main() {<br> add_thingie({{Thingie1::ID(), (ThingieHandler)[=](const Object& o) { do_something1(o);<br>}<br>}<br>, {<br> Thingie2::ID(), (ThingieHandler)[=](const Object &o) { do_something2(o); }<br>}<br>});<br>return 0;<br>}</div><div dir="ltr"><br></div><div>Interestingly, if I remove the C-style cast, it produces something sensible.</div><div><br></div><div>
C:\clang-format_example>clang-format example_good.cpp<br>int main() {<br> add_thingie({{Thingie1::ID(), [=](const Object &o) { do_something1(o); }},<br> {Thingie2::ID(), [=](const Object &o) { do_something2(o); }}});<br> return 0;<br>}</div><div><br></div><div>I could not find any set of options that does something remotely sensible to the original example. Am I missing something?</div><div><br></div><div>Turing<br></div></div></div></div></div>