[cxx-abi-dev] Proposed ABI changes for new C++0x SFINAE rules
David Vandevoorde
daveed at edg.com
Wed Aug 11 17:54:56 UTC 2010
Attached are updated diffs for the ABI spec. Besides a couple of minor fixes, this includes an updated treatment of parameter references in signature expressions. There was a separate thread discussing nested function declarators, but at the recent Rapperswil meeting of WG21, an additional issue came up. Consider:
template<class T> auto f(T const x)->decltype(x); // #1
template<class T> auto f(T x)->decltype(x); // #2
Ordinarily, top-level cv-qualifiers are ignored when forming the function type. E.g., "int(*)(T)" and "int(*)(T const)" are the same type. However, in expression contexts we cannot ignore the cv-qualifiers because the expression must mean the same there as it would if it appeared in the function definition (where cv-qualifiers matter).
So #1 and #2 above must be distinct templates. Rather than encoding the cv-qualifier on the parameter type of the template signature (which would presumably be a serious break of backward compatibility), we're proposing to encode it in the reference in expression contexts (except for known non-class types in rvalue contexts, where the cv-qualifier is meaningless). E.g., rather than encoding "decltype(x)" in #1 as "Dtfp_E" (as we'd do for #2) we use "DtfpK_E".
As usual, feedback is welcome.
Thanks,
Daveed
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SFINAE_diffs-3
Type: application/octet-stream
Size: 36162 bytes
Desc: not available
URL: <http://sourcerytools.com/pipermail/cxx-abi-dev/attachments/20100811/5b64bf74/attachment.obj>
More information about the cxx-abi-dev
mailing list