[cxx-abi-dev] Handling of cast operators in the mangling ABI
Ian Lance Taylor
ian at wasabisystems.com
Mon Nov 24 18:27:14 UTC 2003
Mark Mitchell <mark at codesourcery.com> writes:
> > I think this needs to be spelled out more clearly in the mangling ABI.
> > It's true that the ABI mentions the use of template parameters in
> > parameter/result types, and it's true that the return type of operator
> > A<A>() is in fact A. But I think that the fact that a forward
> > reference is required here, and the fact that it only applies to the
> > cast operator, merits a special mention in the ABI document itself.
> >
> > I recommend adding sentences along the lines of ``The instantiation of
> > a templated conversion operator may use a template parameter number in
> > the <type> which appears in the <operator-name>. This parameter
> > number refers to the template arguments for the templated conversion
> > operator itself. Note that this is a forward reference in the mangled
> > name, as the template arguments will appear after the
> > <operator-name>.''
>
> I don't think there's anything special about a conversion operator.
>
> If you had another member template function with a return value that was
> a template parameter to the function, you would see the same behavior.
Well, yes and no. The difference is that for a conversion operator,
the return type is part of the function name, which means that it
precedes the template arguments. For any other type of function, the
return type follows the function name and hence follows the template
arguments (since the template arguments are part of the function
name).
> If you want to prepare a patch to the HTML document (using the
> non-normative note formatting that is used elsewhere), we can see if
> people want to apply it. (I would certainly be in favor.)
How's this?
Ian
--- mangling-abi.html.~1~ Mon Nov 24 12:39:08 2003
+++ mangling-abi.html Mon Nov 24 13:24:53 2003
@@ -4234,6 +4234,15 @@
distinct from the type (or other substitutible entity)
that is the actual parameter.
+<i>
+Note that for a conversion operator function, the result type is part
+of the name of the function. Since the function name appears before
+the template argument list, the effect is that for a templated
+conversion operator function, if the function name contains a template
+parameter, it is a forward reference to the following template
+arguments.
+</i>
+
</p><pre><code><font color="blue">
<template-param> ::= T_ # first template parameter
::= T <<i>parameter-2 non-negative</i> number> _
More information about the cxx-abi-dev
mailing list