[cxx-abi-dev] mangling for fold-expressions

Richard Smith richardsmith at google.com
Mon Nov 10 18:56:22 UTC 2014


On 10 November 2014 10:30, John McCall <rjmccall at apple.com> wrote:

> On Nov 8, 2014, at 9:16 AM, Richard Smith <richardsmith at google.com> wrote:
> > Hi,
> >
> > WG21 is voting on a proposal for "fold-expressions" today. These are
> syntactically of the form:
> >
> >   ( .... + pack )
> >   ( pack + ... )
> >   ( p0 + ... + pack )
> >   ( pack + ... + pn )
> >
> > (where + can be any binary operator). These expand to
> >
> >   (((p0 + p1) + ...) + pn)
> >
> > for the first and third cases and
> >
> >   (p0 + (p1 + (... + pn)))
> >
> > for the other two cases.
>

I should add:
 - in the first and second cases, the pack is p0 ... pn
 - in the third case, the pack is p1 ... pn
 - in the fourth case, the pack is p0 ... p{n-1}


> And the expansion for (pack + … + pack) is “semantic error”?
>

Yes.


> I assume ‘pack’ is any expression containing an unexpanded pack reference?


Yes.

> These need a mangling; I suggest (and have implemented):
> >
> > <expression> ::=
> >   fl <binary operator-name> <expression>   # ( ... op pack )
> >   fr <binary operator-name> <expression>   # ( pack op ... )
> >   fx <binary operator-name> <expression> <expression>   # ( expr op ...
> op expr )
>
> This doesn’t seem to correspond to one of your examples.


You get this for the third and fourth cases.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/cxx-abi-dev/attachments/20141110/a5e530a5/attachment.html>


More information about the cxx-abi-dev mailing list