On Friday, 14 May 2021 at 10:00:28 UTC, PinDPlugga wrote:
Hi thank you both for your answers. I had understood from an
earlier chapter how this could introduce a bug, but I was
confused because the warning suggests attaching ```return``` to
the parameter, which is empty in the declaration.
The error message here is definitely not as good as it could be.
As a general rule, if you want to apply an attribute to the
`this` reference in a member function, you write it after the
parameter list:
struct S
{
// ...
auto memberFunc() const scope
{
// `this` is const and scope
}
auto anotherOne() share inout
{
// `this` is shared and inout
}
}