Remove FIXME in AST validation. Ticket #8749

This commit is contained in:
Daniel Marjamäki 2018-10-22 11:37:08 +02:00
parent c483bcb12b
commit dc38681a56
3 changed files with 3 additions and 10 deletions

View File

@ -1236,9 +1236,6 @@ void TokenList::validateAst() const
// FIXME: Workaround broken AST assignment in type aliases // FIXME: Workaround broken AST assignment in type aliases
if (Token::Match(tok->previous(), "%name% = %name%")) if (Token::Match(tok->previous(), "%name% = %name%"))
continue; continue;
// FIXME: Workaround when assigning from a new expression: #8749
if (Token::simpleMatch(tok, "= new"))
continue;
if (!tok->astOperand1() || !tok->astOperand2()) if (!tok->astOperand1() || !tok->astOperand2())
throw InternalError(tok, "Syntax Error: AST broken, binary operator '" + tok->str() + "' doesn't have two operands.", InternalError::AST); throw InternalError(tok, "Syntax Error: AST broken, binary operator '" + tok->str() + "' doesn't have two operands.", InternalError::AST);
} }

View File

@ -1617,13 +1617,6 @@ private:
"List<T>::DeleteIf( const Predicate &pred )\n" "List<T>::DeleteIf( const Predicate &pred )\n"
"{}\n"); "{}\n");
// #8749
checkCode(
"typedef char A[1];\n"
"void f(void) {\n"
" char (*p)[1] = new A[1];\n"
"}\n");
// #8749 // #8749
checkCode( checkCode(
"struct A {\n" "struct A {\n"

View File

@ -8259,6 +8259,9 @@ private:
ASSERT_EQUALS("DerivedDerived::(", testAst("Derived::~Derived() {}")); ASSERT_EQUALS("DerivedDerived::(", testAst("Derived::~Derived() {}"));
ASSERT_EQUALS("ifCA_FarReadfilenew(,sizeofobjtype(,(!(", testAst("if (!CA_FarRead(file, (void far *)new, sizeof(objtype)))")); // #5910 - don't hang if C code is parsed as C++ ASSERT_EQUALS("ifCA_FarReadfilenew(,sizeofobjtype(,(!(", testAst("if (!CA_FarRead(file, (void far *)new, sizeof(objtype)))")); // #5910 - don't hang if C code is parsed as C++
// Variable declaration
ASSERT_EQUALS("charp*(3[char5[3[new=", testAst("char (*p)[3] = new char[5][3];"));
} }
void astexpr2() { // limit for large expressions void astexpr2() { // limit for large expressions