<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 misplace '&' character in member function arguments when using [[nodiscard]] attribute on class."
href="https://bugs.llvm.org/show_bug.cgi?id=46243">46243</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang-Format misplace '&' character in member function arguments when using [[nodiscard]] attribute on class.
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>10.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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>laefy22@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>When using the [[no_discard]] attribute between the class / struct keyword and
the type name, the reference '&' will be misplaced in declared member functions
taking types references as parameters.
For example, if I have the PointerAlignment attribute set to Left:
```
struct Toto
{
Toto(Object& obj);
void Function(Object& obj1, Object& obj2);
};
```
when "[[nodiscard]]" is added, becomes:
```
struct [[nodiscard]] Toto
{
Toto(Object & obj);
void Function(Object & obj1, Object & obj2);
};
```
(note the space between 'Object' and '&').
This bug only happens if 'Object' is not a primitive type (so can be class, a
struct, templated or not, an enum, an enum class, an alias), if the reference
is not constant, if the function is not an operator (can be a constructor, a
member function, a static member function) and if the argument is not put after
another argument which is a primitive type, a primitive type reference or any
constant type reference.</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>