This commit is contained in:
parent
c79d859f8b
commit
5791561a45
|
@ -6379,11 +6379,12 @@ void SymbolDatabase::setValueType(Token* tok, const ValueType& valuetype, Source
|
|||
const Token *smartPointerTypeTok = vt2->containerTypeToken;
|
||||
while (Token::Match(smartPointerTypeTok, "%name%|::"))
|
||||
smartPointerTypeTok = smartPointerTypeTok->next();
|
||||
if (Token::Match(smartPointerTypeTok, "< %name% > >") && smartPointerTypeTok->next()->type()) {
|
||||
setType = true;
|
||||
templateArgType = smartPointerTypeTok->next()->type();
|
||||
autovt.smartPointerType = templateArgType;
|
||||
autovt.type = ValueType::Type::NONSTD;
|
||||
if (Token::simpleMatch(smartPointerTypeTok, "<")) {
|
||||
if ((templateArgType = findTypeInNested(smartPointerTypeTok->next(), tok->scope()))) {
|
||||
setType = true;
|
||||
autovt.smartPointerType = templateArgType;
|
||||
autovt.type = ValueType::Type::NONSTD;
|
||||
}
|
||||
}
|
||||
} else if (parsedecl(vt2->containerTypeToken, &autovt, mDefaultSignedness, mSettings, mIsCpp)) {
|
||||
setType = true;
|
||||
|
|
|
@ -8223,6 +8223,24 @@ private:
|
|||
ASSERT(tok && tok->valueType());
|
||||
ASSERT_EQUALS("iterator(std :: vector <)", tok->valueType()->str());
|
||||
}
|
||||
{
|
||||
GET_SYMBOL_DB("struct S {\n"
|
||||
" S() {}\n"
|
||||
" std::vector<std::shared_ptr<S>> v;\n"
|
||||
" void f(int i) const;\n"
|
||||
"};\n"
|
||||
"void S::f(int i) const {\n"
|
||||
" for (const auto& c : v)\n"
|
||||
" c->f(i);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
const Token* tok = tokenizer.tokens();
|
||||
tok = Token::findsimplematch(tok, "auto");
|
||||
ASSERT(tok && tok->valueType() && tok->scope() && tok->scope()->functionOf);
|
||||
const Type* smpType = tok->valueType()->smartPointerType;
|
||||
ASSERT(smpType && smpType == tok->scope()->functionOf->definedType);
|
||||
}
|
||||
}
|
||||
|
||||
void valueTypeThis() {
|
||||
|
|
Loading…
Reference in New Issue