ValueType: Set ValueType for constructor calls

This commit is contained in:
Daniel Marjamäki 2019-10-14 09:19:16 +02:00
parent 267d23f1b8
commit bf61bcf402
2 changed files with 4 additions and 3 deletions

View File

@ -5640,11 +5640,11 @@ void SymbolDatabase::setValueTypeInTokenList(bool reportDebugWarnings)
setValueType(tok, valuetype);
}
// constructor
else if (tok->previous() && tok->previous()->type() && tok->previous()->type()->classScope) {
// constructor call
else if (tok->previous() && tok->previous()->function() && tok->previous()->function()->isConstructor()) {
ValueType valuetype;
valuetype.type = ValueType::RECORD;
valuetype.typeScope = tok->previous()->type()->classScope;
valuetype.typeScope = tok->previous()->function()->token->scope();
setValueType(tok, valuetype);
}

View File

@ -6416,6 +6416,7 @@ private:
ASSERT_EQUALS("signed int", typeOf("auto a(int) -> int; a(5);", "( 5"));
ASSERT_EQUALS("unsigned long", typeOf("sizeof(x);", "("));
ASSERT_EQUALS("signed int", typeOf("int (*a)(int); a(5);", "( 5"));
ASSERT_EQUALS("s", typeOf("struct s { s foo(); s(int, int); }; s s::foo() { return s(1, 2); } ", "( 1 , 2 )"));
// Some standard template functions.. TODO library configuration
ASSERT_EQUALS("signed int", typeOf("std::move(5);", "( 5 )"));