Commit 1336502f authored by Francois Ferrand's avatar Francois Ferrand

C++: fix parsing nested C99 designated initializers.

Change-Id: Iaa0e7550abf6be77601b1852652bb3d0731d0323
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@theqtcompany.com>
parent 672ab5c8
......@@ -5696,7 +5696,13 @@ bool Parser::parseDesignatedInitializer(ExpressionAST *&node)
if (LA() == T_EQUAL) {
ast->equal_token = consumeToken();
if (parseAssignmentExpression(ast->initializer)) {
if (LA() == T_LBRACE) {
if (parseBracedInitList0x(node)) {
node = ast;
return true;
}
} else if (parseAssignmentExpression(ast->initializer)) {
node = ast;
return true;
}
......
......@@ -7,3 +7,12 @@ int a[10] = {2, 4, [8]=9, 10};
int a[MAX] = {
1, 3, 5, 7, 9, [MAX-5] = 8, 6, 4, 2, 0
};
struct {
int table [3];
struct {
int a;
int b;
} parts;
} a[MAX] = {
[2] = { .table = { 8, [1] = 7, 6 }, .parts = { .a = 0, 1 } }
};
Markdown is supported
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