AUTOSAR C++14 Rule A13-2-1
An assignment operator shall return a reference to "this"
Description
Rule Definition
An assignment operator shall return a reference to "this".
Polyspace Implementation
The following operators should return *this
on method, and
*first_arg
on plain function:
operator=
operator+=
operator-=
operator*=
operator >>=
operator <<=
operator /=
operator %=
operator |=
operator &=
operator ^=
Prefix
operator++
Prefix
operator--
Does not report when no return exists.
No special message if type does not match.
Messages in report file:
An assignment operator shall return a reference to
*this
.An assignment operator shall return a reference to its first arg.
Troubleshooting
If you expect a rule violation but Polyspace® does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Check Information
Group: Overloading |
Category: Required, Automated |
Version History
Introduced in R2019a