<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>And even further reduced case:</p>
<p>void F() {<br>
Call({(Cast)[] { f(); }});<br>
}<br>
<br>
</p>
<div class="moz-cite-prefix">On 2019-03-25 13:46, Oleg Smolsky
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:684c4621-e6cb-2867-e9a5-eeaffc87fd35@cohesity.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<p>This looks like a bug (or bugs) in LibFormat. Here is one
reduced case:</p>
<p>Works: <br>
</p>
<p>Call({a, [=]() { something1(o); }, b});</p>
<p>Broken:</p>
<p>namespace ns{<br>
void F() {<br>
Call({a, (Cast)[=]() { something1(o); }, b});<br>
}<br>
}<br>
</p>
<p>The second case counts braces incorrectly.<br>
</p>
<div class="moz-cite-prefix">On 2019-03-21 09:55, Turing Eret via
cfe-dev wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAAJSaQA0OENwd07RKeCeEmK=3xQG=nkwAicbxG54uHHQ00DPRw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<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>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
cfe-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:cfe-dev@lists.llvm.org" moz-do-not-send="true">cfe-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" moz-do-not-send="true">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a>
</pre>
</blockquote>
</blockquote>
</body>
</html>