forked from qt-creator/qt-creator
C++11: Allow brace initializer lists in more places.
This allows them to be used in declarator initializers that expect
an expression list in parentheses. Like
T v({1, 2}, 3, 4);
Change-Id: I62e1ffd355ca88f7acbb8708c9b40c8310489ca3
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
10
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
10
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
@@ -2559,7 +2559,15 @@ bool Parser::parseInitializer0x(ExpressionAST *&node, unsigned *equals_token)
|
|||||||
}
|
}
|
||||||
|
|
||||||
else if (LA() == T_LPAREN) {
|
else if (LA() == T_LPAREN) {
|
||||||
return parsePrimaryExpression(node);
|
ExpressionListParenAST *expr_list_paren = new (_pool) ExpressionListParenAST;
|
||||||
|
node = expr_list_paren;
|
||||||
|
expr_list_paren->lparen_token = consumeToken();
|
||||||
|
|
||||||
|
parseInitializerList0x(expr_list_paren->expression_list);
|
||||||
|
|
||||||
|
match(T_RPAREN, &expr_list_paren->rparen_token);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
Type var1 = { 1, 2, 3};
|
Type var1 = { 1, 2, 3};
|
||||||
Type var2{1, 2, 3};
|
Type var2{1, 2, 3};
|
||||||
//Type var3({1, 2, 3});
|
Type var3({1, 2, 3});
|
||||||
|
|
||||||
class C {
|
class C {
|
||||||
Type var1 = {1, 2, 3};
|
Type var1 = {1, 2, 3};
|
||||||
Type var2{1, 2, 3};
|
Type var2{1, 2, 3};
|
||||||
//Type var3({1, 2, 3});
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user