[llvm-bugs] [Bug 46243] New: Clang-Format misplace '&' character in member function arguments when using [[nodiscard]] attribute on class.
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Jun 8 08:10:57 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46243
Bug ID: 46243
Summary: Clang-Format misplace '&' character in member function
arguments when using [[nodiscard]] attribute on class.
Product: clang
Version: 10.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: Formatter
Assignee: unassignedclangbugs at nondot.org
Reporter: laefy22 at gmail.com
CC: djasper at google.com, klimek at google.com,
llvm-bugs at lists.llvm.org
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200608/38178173/attachment.html>
More information about the llvm-bugs
mailing list