Commit a4245c17 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Improved recovering from errors inside template declarations.

parent c5d110d6
...@@ -986,7 +986,18 @@ bool Parser::parseTemplateDeclaration(DeclarationAST *&node) ...@@ -986,7 +986,18 @@ bool Parser::parseTemplateDeclaration(DeclarationAST *&node)
match(T_GREATER, &ast->greater_token); match(T_GREATER, &ast->greater_token);
} }
parseDeclaration(ast->declaration); do {
unsigned start_declaration = cursor();
ast->declaration = 0;
if (parseDeclaration(ast->declaration))
break;
_translationUnit->error(start_declaration, "expected a declaration");
rewind(start_declaration + 1);
skipUntilDeclaration();
} while (LA());
node = ast; node = ast;
return true; return true;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment