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

Nicola Gigante gigabytes at me.com
Fri Dec 16 07:30:03 PST 2011


Consider this piece of code:

struct S {

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,

-------------- 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/4fd900ee/attachment.obj>

More information about the cfe-commits mailing list