Fix crash in isTemporary() (#4866)
This commit is contained in:
parent
7ce82e4fcb
commit
f2238e717b
|
@ -407,7 +407,7 @@ bool isTemporary(bool cpp, const Token* tok, const Library* library, bool unknow
|
||||||
return false;
|
return false;
|
||||||
if (Token::simpleMatch(tok, "?")) {
|
if (Token::simpleMatch(tok, "?")) {
|
||||||
const Token* branchTok = tok->astOperand2();
|
const Token* branchTok = tok->astOperand2();
|
||||||
if (!branchTok->astOperand1()->valueType())
|
if (!branchTok->astOperand1() || !branchTok->astOperand1()->valueType())
|
||||||
return false;
|
return false;
|
||||||
if (!branchTok->astOperand2()->valueType())
|
if (!branchTok->astOperand2()->valueType())
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -6870,6 +6870,15 @@ private:
|
||||||
" g(x < y ? : 1);\n"
|
" g(x < y ? : 1);\n"
|
||||||
"};\n";
|
"};\n";
|
||||||
valueOfTok(code, "?");
|
valueOfTok(code, "?");
|
||||||
|
|
||||||
|
code = "struct C {\n"
|
||||||
|
" explicit C(bool);\n"
|
||||||
|
" operator bool();\n"
|
||||||
|
"};\n"
|
||||||
|
"void f(bool b) {\n"
|
||||||
|
" const C& c = C(b) ? : C(false);\n"
|
||||||
|
"};\n";
|
||||||
|
valueOfTok(code, "?");
|
||||||
}
|
}
|
||||||
|
|
||||||
void valueFlowHang() {
|
void valueFlowHang() {
|
||||||
|
|
Loading…
Reference in New Issue