<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 - attach-braces after enum doesn't, unless allowshortenums is true"
href="https://bugs.llvm.org/show_bug.cgi?id=49639">49639</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>attach-braces after enum doesn't, unless allowshortenums is true
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>11.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>FreeBSD
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</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>adridg@FreeBSD.org
</td>
</tr>
<tr>
<th>CC</th>
<td>djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Reported by Luna on Twitter; she's stymied by the registration (e.g. real-name
requirements) for the bug tracker. I can reproduce the problem.
This is an issue *similar* to #46927 and possibly #37302; there are a couple
more attach-braces issues open as well. This is the input file:
```
enum EnumWithComma { A, B,
C,
};
enum EnumWithoutComma { A_, B_,
C_ };
struct Struct {
int a;
bool b;
} ;
```
When clang-format 11 (and 12, too) is used with **attached** braces and
*AllowShortEnumsOnASingleLine*, it attaches braces but enums with trailing
commas are somehow not "short".
```
$ clang-format11 --style="{Language: Cpp, BreakBeforeBraces: Attach,
AllowShortEnumsOnASingleLine: true}" example.cpp
enum EnumWithComma {
A,
B,
C,
};
enum EnumWithoutComma { A_, B_, C_ };
struct Struct {
int a;
bool b;
};
```
When clang-format 11 (and 12, too) is used with **attached** braces but short
enums are not allowed on one line, it doesn't attach at all:
```
$ clang-format11 --style="{Language: Cpp, BreakBeforeBraces: Attach,
AllowShortEnumsOnASingleLine: false}" example.cpp
enum EnumWithComma
{
A,
B,
C,
};
enum EnumWithoutComma
{
A_,
B_,
C_
};
struct Struct {
int a;
bool b;
};
```
PS. Probably #37302 and #21200 can be closed, as they refer to ancient versions
of clang-format and suitable configurations for brace-attachment and short
enums (except for this bug) are available now.</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>