#7182 crash: CheckMemoryLeak::functionReturnType()

This commit is contained in:
Alexander Mai 2015-12-05 18:43:29 +01:00
parent 246147c6e6
commit 86c9387987
2 changed files with 10 additions and 1 deletions

View File

@ -344,7 +344,8 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::functionReturnType(const Function* f
const Token* tok = tok2->astOperand1();
if (Token::Match(tok, ".|::"))
tok = tok->astOperand2() ? tok->astOperand2() : tok->astOperand1();
varid = tok->varId();
if (tok)
varid = tok->varId();
break;
}
}

View File

@ -5712,6 +5712,14 @@ private:
" malloc();\n"
"}");
ASSERT_EQUALS("", errout.str());
// #7182 "crash: CheckMemoryLeak::functionReturnType()"
check("template<typename... Ts> auto unary_right_comma (Ts... ts) { return (ts , ...); }\n"
"template<typename T, typename... Ts> auto binary_left_comma (T x, Ts... ts) { return (x , ... , ts); }\n"
"int main() {\n"
" unary_right_comma (a);\n"
"}");
ASSERT_EQUALS("", errout.str());
}
void smartPointerFunctionParam() {