<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 - C++20 `[[likely]]`/`[[unlikely]]` `case` statements erroneously fail to compile in the presence of `[[fallthrough]]`"
href="https://bugs.llvm.org/show_bug.cgi?id=49454">49454</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>C++20 `[[likely]]`/`[[unlikely]]` `case` statements erroneously fail to compile in the presence of `[[fallthrough]]`
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ian@geometrian.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>See the following complete example:
//Compile with "-std=c++20"
void f(int i) {
switch (i) {
[[likely]] case 1:
[[fallthrough]];
case 2:
break;
}
}
This should compile (and does on every other compiler), but doesn't on Clang.
Clang (tested 13.0.0) produces:
<source>:5:13: error: fallthrough annotation does not directly precede
switch label
[[fallthrough]];
^
Removing either `[[likely]]` or `[[fallthrough]];` is sufficient to cause the
compile to succeed.</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>