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

Nicola Gigante gigabytes at me.com
Fri Dec 16 07:30:03 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-dev/attachments/20111216/4fd900ee/attachment.obj>


More information about the cfe-dev mailing list