This commit is contained in:
parent
9cf934c10d
commit
c4784a1552
|
@ -637,7 +637,7 @@ static bool iscpp11init_impl(const Token * const tok)
|
||||||
return false;
|
return false;
|
||||||
if (nameToken->str() == ")" && Token::simpleMatch(nameToken->link()->previous(), "decltype (") &&
|
if (nameToken->str() == ")" && Token::simpleMatch(nameToken->link()->previous(), "decltype (") &&
|
||||||
!Token::simpleMatch(nameToken->link()->tokAt(-2), "."))
|
!Token::simpleMatch(nameToken->link()->tokAt(-2), "."))
|
||||||
return true;
|
nameToken = nameToken->link()->previous();
|
||||||
if (Token::simpleMatch(nameToken, ", {"))
|
if (Token::simpleMatch(nameToken, ", {"))
|
||||||
return true;
|
return true;
|
||||||
if (nameToken->str() == ">" && nameToken->link())
|
if (nameToken->str() == ">" && nameToken->link())
|
||||||
|
@ -667,6 +667,8 @@ static bool iscpp11init_impl(const Token * const tok)
|
||||||
endtok = nameToken->linkAt(1)->linkAt(1);
|
endtok = nameToken->linkAt(1)->linkAt(1);
|
||||||
else if (Token::Match(nameToken->previous(), "%name%|> ( {"))
|
else if (Token::Match(nameToken->previous(), "%name%|> ( {"))
|
||||||
endtok = nameToken->linkAt(1);
|
endtok = nameToken->linkAt(1);
|
||||||
|
else if (Token::simpleMatch(nameToken, "decltype") && nameToken->linkAt(1))
|
||||||
|
endtok = nameToken->linkAt(1)->linkAt(1);
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
if (Token::Match(nameToken, "else|try|do|const|constexpr|override|volatile|&|&&"))
|
if (Token::Match(nameToken, "else|try|do|const|constexpr|override|volatile|&|&&"))
|
||||||
|
@ -689,7 +691,7 @@ static bool iscpp11init_impl(const Token * const tok)
|
||||||
if (!Token::simpleMatch(endtok, "} ;"))
|
if (!Token::simpleMatch(endtok, "} ;"))
|
||||||
return true;
|
return true;
|
||||||
const Token *prev = nameToken;
|
const Token *prev = nameToken;
|
||||||
while (Token::Match(prev, "%name%|::|:|<|>|,|%num%|%cop%")) {
|
while (Token::Match(prev, "%name%|::|:|<|>|(|)|,|%num%|%cop%")) {
|
||||||
if (Token::Match(prev, "class|struct|union|enum"))
|
if (Token::Match(prev, "class|struct|union|enum"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -7557,6 +7557,13 @@ private:
|
||||||
"};\n",
|
"};\n",
|
||||||
"{ } }",
|
"{ } }",
|
||||||
TokenImpl::Cpp11init::NOINIT);
|
TokenImpl::Cpp11init::NOINIT);
|
||||||
|
|
||||||
|
testIsCpp11init("struct S { int i; } s;\n"
|
||||||
|
"struct T : decltype (s) {\n"
|
||||||
|
" T() : decltype(s) ({ 0 }) { }\n"
|
||||||
|
"};\n",
|
||||||
|
"{ } }",
|
||||||
|
TokenImpl::Cpp11init::NOINIT);
|
||||||
#undef testIsCpp11init
|
#undef testIsCpp11init
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue