Fix 10738: FP knownEmptyContainer with auto reference (#3734)
* Fix 10738: FP knownEmptyContainer with auto reference * Format
This commit is contained in:
parent
6c2b1f093d
commit
a7dbd288c4
|
@ -5858,7 +5858,7 @@ void SymbolDatabase::setValueType(Token *tok, const ValueType &valuetype)
|
||||||
Token *autoTok = nullptr;
|
Token *autoTok = nullptr;
|
||||||
if (Token::Match(var1Tok->tokAt(-2), ";|{|}|(|const|constexpr auto"))
|
if (Token::Match(var1Tok->tokAt(-2), ";|{|}|(|const|constexpr auto"))
|
||||||
autoTok = var1Tok->previous();
|
autoTok = var1Tok->previous();
|
||||||
else if (Token::Match(var1Tok->tokAt(-3), ";|{|}|(|const|constexpr auto *"))
|
else if (Token::Match(var1Tok->tokAt(-3), ";|{|}|(|const|constexpr auto *|&|&&"))
|
||||||
autoTok = var1Tok->tokAt(-2);
|
autoTok = var1Tok->tokAt(-2);
|
||||||
if (autoTok) {
|
if (autoTok) {
|
||||||
ValueType vt(*vt2);
|
ValueType vt(*vt2);
|
||||||
|
|
|
@ -5481,6 +5481,15 @@ private:
|
||||||
"}\n",
|
"}\n",
|
||||||
true);
|
true);
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
check("void f() {\n"
|
||||||
|
" std::vector<int> v;\n"
|
||||||
|
" auto& rv = v;\n"
|
||||||
|
" rv.push_back(42);\n"
|
||||||
|
" for (auto i : v) {}\n"
|
||||||
|
"}\n",
|
||||||
|
true);
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkMutexes() {
|
void checkMutexes() {
|
||||||
|
|
Loading…
Reference in New Issue