Commit 0bdf1dc4 authored by Christian Kamm's avatar Christian Kamm Committed by hjk
Browse files

C++11: Allow brace initializers in return statements.



Like return {1, 2};

Change-Id: I7442da1866b0106bc075783653c95c16ebedb51a
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent bd04f2ed
......@@ -3102,7 +3102,10 @@ bool Parser::parseReturnStatement(StatementAST *&node)
if (LA() == T_RETURN) {
ReturnStatementAST *ast = new (_pool) ReturnStatementAST;
ast->return_token = consumeToken();
parseExpression(ast->expression);
if (_cxx0xEnabled && LA() == T_LBRACE)
parseBracedInitList0x(ast->expression);
else
parseExpression(ast->expression);
match(T_SEMICOLON, &ast->semicolon_token);
node = ast;
return true;
......
......@@ -12,3 +12,7 @@ void main() {
Type var2{{1, 2, 3}, 4};
var3 += {1, 2};
}
T foo() {
return {1, 2, {"foo", 7}};
}
Supports Markdown
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