This commit is contained in:
parent
47ba053054
commit
343a23135d
|
@ -643,7 +643,7 @@ static bool iscpp11init_impl(const Token * const tok)
|
|||
endtok = nameToken->linkAt(1);
|
||||
else if (Token::Match(nameToken,"%name% <") && Token::simpleMatch(nameToken->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);
|
||||
else
|
||||
return false;
|
||||
|
@ -1574,7 +1574,7 @@ static Token * createAstAtToken(Token *tok, bool cpp)
|
|||
if (typetok &&
|
||||
typecount >= 2 &&
|
||||
!Token::Match(tok, "return|throw") &&
|
||||
Token::Match(typetok->previous(), "%name% (") &&
|
||||
Token::Match(typetok->previous(), "%name% ( !!*") &&
|
||||
typetok->previous()->varId() == 0 &&
|
||||
!typetok->previous()->isKeyword() &&
|
||||
Token::Match(typetok->link(), ") const|;|{"))
|
||||
|
|
|
@ -309,6 +309,11 @@ private:
|
|||
" int x{1};\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("std::vector<int> f(int* p) {\n"
|
||||
" return std::vector<int>({ p[0] });\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void cpp11init2() {
|
||||
|
@ -580,6 +585,11 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void f(int* p) {\n" // #10932
|
||||
" int& r(*p[0]);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("struct S { int i; };\n" // #10917
|
||||
"bool f(S s) {\n"
|
||||
" return [](int i) { return i > 0; }(s.i);\n"
|
||||
|
|
|
@ -6185,6 +6185,7 @@ private:
|
|||
ASSERT_EQUALS("var1ab::23,{,4ab::56,{,{,{{", testAst("auto var{{1,a::b{2,3}}, {4,a::b{5,6}}};"));
|
||||
ASSERT_EQUALS("var{{,{,{{", testAst("auto var{ {{},{}}, {} };"));
|
||||
ASSERT_EQUALS("fXYabcfalse==CD:?,{,{(", testAst("f({X, {Y, abc == false ? C : D}});"));
|
||||
ASSERT_EQUALS("stdvector::p0[{(return", testAst("return std::vector<int>({ p[0] });"));
|
||||
|
||||
// Initialization with decltype(expr) instead of a type
|
||||
ASSERT_EQUALS("decltypex((", testAst("decltype(x)();"));
|
||||
|
@ -6214,6 +6215,7 @@ private:
|
|||
ASSERT_EQUALS("a1[\"\"=", testAst("char a[1]=\"\";"));
|
||||
ASSERT_EQUALS("charp*(3[char5[3[new=", testAst("char (*p)[3] = new char[5][3];"));
|
||||
ASSERT_EQUALS("varp=", testAst("const int *var = p;"));
|
||||
ASSERT_EQUALS("intrp0[*(&", testAst("int& r(*p[0]);"));
|
||||
|
||||
// #9127
|
||||
const char code1[] = "using uno::Ref;\n"
|
||||
|
|
Loading…
Reference in New Issue