[cfe-commits] Fix of syntactic InitListExpr with constructor initialization

Nicola Gigante nicola.gigante at gmail.com
Fri Dec 16 07:32:37 PST 2011


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: InitListExpr.patch
Type: application/octet-stream
Size: 2028 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111216/410fd14b/attachment.obj>
-------------- next part --------------



More information about the cfe-commits mailing list