<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - clang-format broken after lambda with return type template with boolean literal"
href="https://bugs.llvm.org/show_bug.cgi?id=40910">40910</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang-format broken after lambda with return type template with boolean literal
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>8.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Formatter
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nikolaus@nikolaus-demmel.de
</td>
</tr>
<tr>
<th>CC</th>
<td>djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Clang format breaks on lambdas with return types that have literal booleans in
template arguments, e.g.
[]() -> foo<true> { ; }();
The same works fine e.g. with integer literals. I tried version 7, 8, and
current version 9 from the Ubuntu Xenial apt repo and the behaviour is the same
everywhere. I narrowed it down to the following small test case:
template <bool>
using foo = void;
// works:
[]() -> foo<1> { ; }();
// broken:
[]() -> foo<true> { ; }();
namespace bar {
// broken:
auto foo{[]() -> foo<false> { ; }};
} // namespace bar
I would expect clang-format (without additional options) to not change anything
here (which is the case if I replace 'true' / 'false' with e.g. '1', but the
actual result is as follows, which is particularly problematic in the presence
of namespaces as you can see:
template <bool>
using foo = void;
// works:
[]() -> foo<1> { ; }();
// broken:
[]() -> foo<true> { ; }
();
namespace bar {
// broken:
auto foo{[]() -> foo<false>{;
} // namespace bar
}
;
} // namespace bar</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>