mirror of
https://github.com/github/codeql.git
synced 2026-05-03 12:45:27 +02:00
C++: Add false positive testcase involving assignments.
This commit is contained in:
@@ -16,3 +16,4 @@
|
||||
| test.cpp:151:9:151:24 | new | This allocation cannot throw. $@ is unnecessary. | test.cpp:152:15:152:18 | { ... } | This catch block |
|
||||
| test.cpp:199:15:199:35 | new | This allocation cannot throw. $@ is unnecessary. | test.cpp:201:16:201:19 | { ... } | This catch block |
|
||||
| test.cpp:212:14:212:34 | new | This allocation cannot throw. $@ is unnecessary. | test.cpp:213:34:213:36 | { ... } | This catch block |
|
||||
| test.cpp:219:9:219:15 | new | This allocation cannot throw. $@ is unnecessary. | test.cpp:220:34:220:36 | { ... } | This catch block |
|
||||
|
||||
@@ -212,3 +212,10 @@ void bad_new_catch_baseclass_of_bad_alloc() {
|
||||
int* p = new(std::nothrow) int; // BAD
|
||||
} catch(const std::exception&) { }
|
||||
}
|
||||
|
||||
void good_new_catch_exception_in_assignment() {
|
||||
int* p;
|
||||
try {
|
||||
p = new int; // GOOD [FALSE POSITIVE]
|
||||
} catch(const std::bad_alloc&) { }
|
||||
}
|
||||
Reference in New Issue
Block a user