[cxx-abi-dev] Mangling late-specified return types/decltype

John H. Spicer jhs at edg.com
Fri Sep 5 19:02:18 UTC 2008


On Sep 5, 2008, at 1:27 PM, Jason Merrill wrote:

> Consider
>
> template<class T, class U>
> auto add(T t, U u) -> decltype (t+u);
>
> There is currently no way to mangle "t" in the ABI.  Currently I'm  
> dealing this by replacing "t" in the return type with *(T*)0, but  
> that seems inelegant (and unnecessarily long).
>
> I think we don't want to mangle it as a reference to a function  
> parameter, but rather as a placeholder expression with the type of  
> the parameter.  Perhaps sT <type>?

That might be okay, but I'm not sure what the advantage is.  You need  
to be able to handle things like decltype(t.x + u.x) so you need to  
represent expressions of which the parameter is component.

John.

>
>
> Incidentally, the ABI still lacks any way to mangle T() or myfn(args).
>
> We could mangle T() using 'v' for the operand.
>
> We could mangle myfn(args) as a binary expression using the encoding  
> for operator() where the first operand is the name of the function  
> and the second operand is the list of args wrapped in some delimiters.
>
> Do these seem reasonable to other people?
>




More information about the cxx-abi-dev mailing list