forked from qt-creator/qt-creator
C++11: Don't fail on = default and = delete initializers.
These are converted to IdExpr(SimpleName(token)) initializers. Change-Id: I1e85c4b261ca028dc75ffe6c00e1090630c2957c Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
13
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
13
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
@@ -2510,6 +2510,19 @@ bool Parser::parseInitDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_sp
|
||||
return true;
|
||||
}
|
||||
rewind(colon_token);
|
||||
} else if (isFunctionDeclarator && declaringClass && node->core_declarator && LA() == T_EQUAL && LA(3) == T_SEMICOLON) { // = 0, = delete, = default
|
||||
if (!_cxx0xEnabled || LA(2) == T_NUMERIC_LITERAL) {
|
||||
parseInitializer(node->initializer, &node->equal_token);
|
||||
} else {
|
||||
node->equal_token = consumeToken();
|
||||
|
||||
IdExpressionAST *id_expr = new (_pool) IdExpressionAST;
|
||||
node->initializer = id_expr;
|
||||
|
||||
SimpleNameAST *simple_name = new (_pool) SimpleNameAST;
|
||||
id_expr->name = simple_name;
|
||||
simple_name->identifier_token = consumeToken();
|
||||
}
|
||||
} else if (node->core_declarator && (LA() == T_EQUAL || (_cxx0xEnabled && !isFunctionDeclarator && LA() == T_LBRACE) || (! declaringClass && LA() == T_LPAREN))) {
|
||||
parseInitializer(node->initializer, &node->equal_token);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user