[cxx-abi-dev] Literal operator functions with 'li<length, ID>'

Richard Smith richardsmith at google.com
Tue Jul 9 20:25:29 UTC 2013


On Tue, Jul 9, 2013 at 11:12 AM, Mike Herrick <mjh at edg.com> wrote:

> Hi,
>
> It appears that this patch for user-defined literals hasn't been applied
> to the document (though it is used by at least g++ and clang).
>
> On Jun 5, 2011, at 4:11 AM, Sean Hunt <scshunt at csclub.uwaterloo.ca> wrote:
>
> > Hi,
> >
> > I don't know where to find the document to patch against, but I'd like
> to suggest that the line
> >
> >                 ::= li <source-name>  # "" <source-name>
> >
> > be added somewhere amongst the productions for <operator-name> in 5.1.3
> since it's not yet in the document.
>
> Additionally, how about a case like this:
>
> int operator "" _w(const char*);
> template <class T> auto f(T p1) -> decltype(123_w, p1);
> int main() {
>   f(456_w);
> }
>
> Clang gives a mangling of _Z1fIiEDTcmclL_Zli2_wPKcELA4_cEEfp_ET_, but g++
> aborts on this case.  I don't believe I've seen a discussion of this.


Modeling a UDL as a call to the corresponding literal operator is an
accident of Clang's implementation rather than a deliberate choice of
mangling, but it seems reasonable to me.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/cxx-abi-dev/attachments/20130709/58718b16/attachment.html>


More information about the cxx-abi-dev mailing list