forked from qt-creator/qt-creator
Fix invalid decltype error recovery which resulted in crashes.
Task-number: QTCREATORBUG-7174 Change-Id: I653db71adc45586cd8518ffd96118425fd3763be Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
This commit is contained in:
4
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
4
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
@@ -3638,11 +3638,9 @@ bool Parser::parseBuiltinTypeSpecifier(SpecifierListAST *&node)
|
||||
DecltypeSpecifierAST *ast = new (_pool) DecltypeSpecifierAST;
|
||||
ast->decltype_token = consumeToken();
|
||||
match(T_LPAREN, &ast->lparen_token);
|
||||
if (parseExpression(ast->expression)) {
|
||||
if (parseExpression(ast->expression))
|
||||
match(T_RPAREN, &ast->rparen_token);
|
||||
node = new (_pool) SpecifierListAST(ast);
|
||||
return true;
|
||||
}
|
||||
skipUntilDeclaration();
|
||||
return true;
|
||||
} else if (lookAtBuiltinTypeSpecifier()) {
|
||||
|
@@ -101,6 +101,7 @@ private slots:
|
||||
void gcc_attributes_1();
|
||||
void gcc_attributes_2();
|
||||
void gcc_attributes_3();
|
||||
void crash_test_1();
|
||||
|
||||
// expressions
|
||||
void simple_name_1();
|
||||
@@ -212,6 +213,13 @@ void tst_AST::gcc_attributes_3()
|
||||
QCOMPARE(unit->tokenKind(link->rbrace_token), (int) T_RBRACE);
|
||||
}
|
||||
|
||||
void tst_AST::crash_test_1()
|
||||
{
|
||||
QSharedPointer<TranslationUnit> unit(parseStatement("decltype auto\n"));
|
||||
AST *ast = unit->ast();
|
||||
QVERIFY(ast);
|
||||
}
|
||||
|
||||
void tst_AST::simple_declaration_1()
|
||||
{
|
||||
QSharedPointer<TranslationUnit> unit(parseStatement("\n"
|
||||
|
Reference in New Issue
Block a user