parent
36d98a8b5a
commit
c878285a42
|
@ -1830,6 +1830,16 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void f() { throw(1); }\n"); // #8958
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("class C {\n" // #9002
|
||||
"public:\n"
|
||||
" static int f() { return 1; }\n"
|
||||
"};\n"
|
||||
"void g() { C::f(); }\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
settings.severity = severity_old;
|
||||
settings.checkLibrary = false;
|
||||
}
|
||||
|
|
|
@ -896,6 +896,11 @@ private:
|
|||
" s[x*s.size()] = 1;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("test.cpp:2:error:Out of bounds access of s, index 'x*s.size()' is out of bounds.\n", errout.str());
|
||||
|
||||
checkNormal("bool f(std::string_view& sv) {\n" // #10031
|
||||
" return sv[sv.size()] == '\\0';\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("test.cpp:2:error:Out of bounds access of sv, index 'sv.size()' is out of bounds.\n", errout.str());
|
||||
}
|
||||
void outOfBoundsIterator() {
|
||||
check("int f() {\n"
|
||||
|
@ -1575,6 +1580,17 @@ private:
|
|||
ASSERT_EQUALS(
|
||||
"[test.cpp:6] -> [test.cpp:6]: (error) Same iterator is used with containers 'g()' that are temporaries or defined in different scopes.\n",
|
||||
errout.str());
|
||||
|
||||
check("std::set<long> f() {\n" // #5804
|
||||
" std::set<long> s;\n"
|
||||
" return s;\n"
|
||||
"}\n"
|
||||
"void g() {\n"
|
||||
" for (std::set<long>::iterator it = f().begin(); it != f().end(); ++it) {}\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS(
|
||||
"[test.cpp:6] -> [test.cpp:6]: (error) Same iterator is used with containers 'f()' that are temporaries or defined in different scopes.\n",
|
||||
errout.str());
|
||||
}
|
||||
|
||||
void iterator20() {
|
||||
|
|
Loading…
Reference in New Issue