* Fix #10793 internalAstError with brace-init in ternary * Undo
This commit is contained in:
parent
39265f8ce0
commit
955d6d8fc6
|
@ -636,6 +636,13 @@ static bool iscpp11init_impl(const Token * const tok)
|
|||
return true;
|
||||
if (nameToken->str() == ">" && nameToken->link())
|
||||
nameToken = nameToken->link()->previous();
|
||||
if (nameToken->str() == "]") {
|
||||
const Token* newTok = nameToken->link()->previous();
|
||||
while (Token::Match(newTok, "%type%") && !newTok->isKeyword())
|
||||
newTok = newTok->previous();
|
||||
if (Token::simpleMatch(newTok, "new"))
|
||||
return true;
|
||||
}
|
||||
|
||||
const Token *endtok = nullptr;
|
||||
if (Token::Match(nameToken, "%name%|return|: {") &&
|
||||
|
|
|
@ -6046,6 +6046,7 @@ private:
|
|||
ASSERT_EQUALS("Aa*A{new=", testAst("A* a = new A{};"));
|
||||
ASSERT_EQUALS("Aa*A12,{new=", testAst("A* a = new A{ 1, 2 };"));
|
||||
ASSERT_EQUALS("Sv0[(new", testAst("new S(v[0]);")); // #10929
|
||||
ASSERT_EQUALS("SS::x(px0>intx[{newint1[{new:?(:", testAst("S::S(int x) : p(x > 0 ? new int[x]{} : new int[1]{}) {}")); // #10793
|
||||
|
||||
// placement new
|
||||
ASSERT_EQUALS("X12,3,(new ab,c,", testAst("new (a,b,c) X(1,2,3);"));
|
||||
|
|
Loading…
Reference in New Issue