mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
C++: Cover more cases of returning *this
This commit is contained in:
@@ -134,7 +134,7 @@ public:
|
||||
};
|
||||
|
||||
class Reachability {
|
||||
Reachability &operator=(Reachability &that) { // GOOD [FALSE POSITIVE]
|
||||
Reachability &operator=(Reachability &that) { // GOOD
|
||||
int one = 1;
|
||||
if (one)
|
||||
return *this;
|
||||
@@ -160,11 +160,11 @@ class Reachability {
|
||||
return &staticInstance; // unreachable
|
||||
}
|
||||
|
||||
Reachability &operator=(int _val) { // GOOD [FALSE POSITIVE]
|
||||
Reachability &operator=(int _val) { // GOOD
|
||||
return returnThisReference();
|
||||
}
|
||||
|
||||
Reachability &operator=(short _val) { // GOOD [FALSE POSITIVE]
|
||||
Reachability &operator=(short _val) { // GOOD
|
||||
return *returnThisPointer();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,3 @@
|
||||
| AV Rule 82.cpp:24:8:24:16 | operator= | Assignment operator in class Bad2 should have return type Bad2&. Otherwise a copy is created at each call. |
|
||||
| AV Rule 82.cpp:63:29:63:37 | operator= | Assignment operator in class TemplateReturnAssignment<T> does not return a reference to *this. |
|
||||
| AV Rule 82.cpp:63:29:63:37 | operator= | Assignment operator in class TemplateReturnAssignment<int> does not return a reference to *this. |
|
||||
| AV Rule 82.cpp:137:17:137:25 | operator= | Assignment operator in class Reachability does not return a reference to *this. |
|
||||
| AV Rule 82.cpp:163:17:163:25 | operator= | Assignment operator in class Reachability does not return a reference to *this. |
|
||||
| AV Rule 82.cpp:167:17:167:25 | operator= | Assignment operator in class Reachability does not return a reference to *this. |
|
||||
|
||||
Reference in New Issue
Block a user