MISRAC++2023-6.8.4 (C++ only)
In this section:
Synopsis
(Advisory) Member functions returning references to their object should be ref-qualified appropriately
Enabled by default
No
Severity/Certainty
Low/Medium

Full description
Member function is not appropriately ref-qualified
Coding standards
This check does not correspond to any coding standard rules.
Code examples
The following code example fails the check and will give a warning:
class C
{
public:
C& me() { return *this; }
};
The following code example passes the check and will not give a warning about this issue:
class C
{
public:
C& me() & { return *this;}
};