Hello.
Consider this piece of code:
struct S {
S(int);
};
void func() {
int a = { [0 ... 2] = 3.0 };
S s = { [0 ... 2] = 3 };
}
In the first case (int array), the syntactic form of the InitListExpr
node contains the ImplicitCastExpr that builds the initialization
of the designator subobjects, while in the second case, the
syntactic form contains only the IntegerLiteral, without all the
implicit casts and CXXConstructExpr.
This inconsistency makes the code of some clients more
complicated than needed.
Here is a patch that fixes this behaviour. It passes all the tests.
If you think it's ok, I'll commit it.
Thank you,
Nicola
InitListExpr.patch (1.98 KB)
Hello.
Consider this piece of code:
struct S {
S(int);
};
void func() {
int a = { [0 ... 2] = 3.0 };
S s = { [0 ... 2] = 3 };
}
In the first case (int array), the syntactic form of the InitListExpr
node contains the ImplicitCastExpr that builds the initialization
of the designator subobjects, while in the second case, the
syntactic form contains only the IntegerLiteral, without all the
implicit casts and CXXConstructExpr.
This inconsistency makes the code of some clients more
complicated than needed.
Here is a patch that fixes this behaviour. It passes all the tests.
If you think it's ok, I'll commit it.
Thank you,
Nicola
InitListExpr.patch (1.98 KB)
Looks basically good to me, but I would appreciate a comment that describes what exactly the whole “LastCheckedObject” thing does.
Sebastian
Looks basically good to me, but I would appreciate a comment that describes what exactly the whole "LastCheckedObject" thing does.
Sure. Here's the patch with a comment that I think is sufficiently clear.
Ok to commit?
Sebastian
Thanks,
Nicola
InitListExpr.patch (2.6 KB)
Comment looks good. Typo in "inizialization".
Since this only affects the syntactic form, it should have no effect on CodeGen, so I'd say go ahead.
Sebastian