﻿# V790\. It is suspicious that the assignment operator takes an object by a non\-constant reference and returns this object\.

The analyzer has detected an assignment operator that receives an object by a non\-constant reference and returns that same object\.

Consider the following example:

```cpp
class C {
  C& operator = (C& other) {
    ....
    return other;
  }
};
```

Implementing an assignment operator in a way like that could lead to unexpected and unpleasant side effects\. Suppose we write the following code:

```cpp
(A = B)++;
```

You should not really write the code like that, but just suppose we need it exactly that way\. You would probably expect the following sequence of operations:

```cpp
A = B;
A++;
```

However, because of the incorrect assignment operator, the actual order will be this:

```cpp
A = B;
B++;
```

To avoid errors like that, pass the argument by a constant reference: code with such an implementation of the assignment operator would simply fail to compile\.

Fixed code:

```cpp
class C {
  C& operator = (const C& other) {
    ....
    return *this;
  }
};
```