Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7819,7 +7819,7 @@ void SymbolDatabase::setValueTypeInTokenList(bool reportDebugWarnings, Token *to

setValueType(tok, ValueType(sign, type, 0U));
}
} else if (tok->isComparisonOp() || tok->tokType() == Token::eLogicalOp) {
} else if ((tok->isComparisonOp() || tok->tokType() == Token::eLogicalOp) && tok->astOperand1()) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we call tok->isBinaryOp() instead to make it more explicit

if (tok->isCpp() && tok->isComparisonOp() && (getClassScope(tok->astOperand1()) || getClassScope(tok->astOperand2()))) {
const Function *function = getOperatorFunction(tok);
if (function) {
Expand Down
9 changes: 9 additions & 0 deletions test/testsymboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10164,6 +10164,15 @@ class TestSymbolDatabase : public TestFixture {
ASSERT(tok);
TODO_ASSERT(tok->valueType() && "container(std :: string|wstring|u16string|u32string)" == tok->valueType()->str());
}
{
GET_SYMBOL_DB("void f() {\n"
" int &&x = 0;\n"
"}\n");

const Token* tok = Token::findsimplematch(tokenizer.tokens(), "&&");
ASSERT(tok);
ASSERT_EQUALS(static_cast<const ValueType*>(nullptr), tok->valueType());
}
}

void valueTypeThis() {
Expand Down
Loading