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;
|
||||
if (Token::simpleMatch(tok, "?")) {
|
||||
const Token* branchTok = tok->astOperand2();
|
||||
if (!branchTok->astOperand1()->valueType())
|
||||
if (!branchTok->astOperand1() || !branchTok->astOperand1()->valueType())
|
||||
return false;
|
||||
if (!branchTok->astOperand2()->valueType())
|
||||
return false;
|
||||
|
|
|
@ -6870,6 +6870,15 @@ private:
|
|||
" g(x < y ? : 1);\n"
|
||||
"};\n";
|
||||
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() {
|
||||
|
|
Loading…
Reference in New Issue