parent
52264b9c26
commit
4cb49013a7
|
@ -2178,8 +2178,6 @@ T* getTokenArgumentFunctionImpl(T* tok, int& argn)
|
|||
return nullptr;
|
||||
if (Token::simpleMatch(argtok, ","))
|
||||
argtok = argtok->astOperand1();
|
||||
if (Token::simpleMatch(argtok, "(") && argtok->astOperand2())
|
||||
argtok = argtok->astOperand2();
|
||||
tok = argtok;
|
||||
while (Token::Match(tok->astParent(), ",|(|{")) {
|
||||
tok = tok->astParent();
|
||||
|
|
|
@ -326,6 +326,8 @@ private:
|
|||
ASSERT(Result::True == isUsedAsBool("void f(bool b); void f() { int i; f(i); }","i )"));
|
||||
ASSERT(Result::True == isUsedAsBool("void f() { int *i; if (*i) {} }", "i )"));
|
||||
ASSERT(Result::True == isUsedAsBool("void f() { int *i; if (*i) {} }", "* i )"));
|
||||
ASSERT(Result::True == isUsedAsBool("int g(); void h(bool); void f() { h(g()); }", "( ) )"));
|
||||
ASSERT(Result::True == isUsedAsBool("int g(int); void h(bool); void f() { h(g(0)); }", "( 0 ) )"));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -2749,6 +2749,14 @@ private:
|
|||
" v.data();\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:2] -> [test.cpp:3]: (error) Using object that is a temporary.\n", errout.str());
|
||||
|
||||
check("std::string convert(std::string_view sv) { return std::string{ sv }; }\n" // #11374
|
||||
"auto f() {\n"
|
||||
" std::vector<std::string> v;\n"
|
||||
" v.push_back(convert(\"foo\"));\n"
|
||||
" return v[0];\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void danglingLifetimeUniquePtr()
|
||||
|
|
Loading…
Reference in New Issue