C++: Regression tests for AV Rule 82

Without the last commit, this addition to the test gives the following
results:

```
+| AV Rule 82.cpp:176:14:176:22 | operator= | Assignment operator in class Forgivable does not return a reference to *this. |
+| AV Rule 82.cpp:181:14:181:22 | operator= | Assignment operator in class Forgivable does not return a reference to *this. |
```
This commit is contained in:
Jonas Jensen
2018-11-06 16:13:44 +01:00
parent da73a033e5
commit 9382c9d528

View File

@@ -171,6 +171,16 @@ class Reachability {
static Reachability staticInstance;
};
class Forgivable {
// GOOD: wrong return type but that doesn't matter on a deleted function.
Forgivable operator=(const Forgivable &_val) = delete;
private:
// GOOD: wrong return type but that doesn't matter because this operator is
// private and probably also unimplemented, so no code can call it.
Forgivable operator=(int *_val);
};
int main() {
Container c;
c = c;