forked from qt-creator/qt-creator
C++11: Allow brace initializers in return statements.
Like return {1, 2};
Change-Id: I7442da1866b0106bc075783653c95c16ebedb51a
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
3
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
3
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
@@ -3102,6 +3102,9 @@ bool Parser::parseReturnStatement(StatementAST *&node)
|
||||
if (LA() == T_RETURN) {
|
||||
ReturnStatementAST *ast = new (_pool) ReturnStatementAST;
|
||||
ast->return_token = consumeToken();
|
||||
if (_cxx0xEnabled && LA() == T_LBRACE)
|
||||
parseBracedInitList0x(ast->expression);
|
||||
else
|
||||
parseExpression(ast->expression);
|
||||
match(T_SEMICOLON, &ast->semicolon_token);
|
||||
node = ast;
|
||||
|
||||
@@ -12,3 +12,7 @@ void main() {
|
||||
Type var2{{1, 2, 3}, 4};
|
||||
var3 += {1, 2};
|
||||
}
|
||||
|
||||
T foo() {
|
||||
return {1, 2, {"foo", 7}};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user