Mangling late-specified return types/decltype

Jason Merrill jason at redhat.com
Fri Sep 5 17:27:06 UTC 2008


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>?

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