Skip to content

Commit 80ab538

Browse files
authored
Fix #14803: ValueType::BOOL set for && in rvalue reference declaration (#8606)
1 parent 4e3063e commit 80ab538

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

lib/symboldatabase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7823,7 +7823,7 @@ void SymbolDatabase::setValueTypeInTokenList(bool reportDebugWarnings, Token *to
78237823

78247824
setValueType(tok, ValueType(sign, type, 0U));
78257825
}
7826-
} else if (tok->isComparisonOp() || tok->tokType() == Token::eLogicalOp) {
7826+
} else if ((tok->isComparisonOp() || tok->tokType() == Token::eLogicalOp) && tok->astOperand1()) {
78277827
if (tok->isCpp() && tok->isComparisonOp() && (getClassScope(tok->astOperand1()) || getClassScope(tok->astOperand2()))) {
78287828
const Function *function = getOperatorFunction(tok);
78297829
if (function) {

test/testsymboldatabase.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10192,6 +10192,15 @@ class TestSymbolDatabase : public TestFixture {
1019210192
ASSERT(tok);
1019310193
TODO_ASSERT(tok->valueType() && "container(std :: string|wstring|u16string|u32string)" == tok->valueType()->str());
1019410194
}
10195+
{
10196+
GET_SYMBOL_DB("void f() {\n"
10197+
" int &&x = 0;\n"
10198+
"}\n");
10199+
10200+
const Token* tok = Token::findsimplematch(tokenizer.tokens(), "&&");
10201+
ASSERT(tok);
10202+
ASSERT_EQUALS(static_cast<const ValueType*>(nullptr), tok->valueType());
10203+
}
1019510204
}
1019610205

1019710206
void valueTypeThis() {

0 commit comments

Comments
 (0)