[cxx-abi-dev] A mangling ambiguity
Martin v. Löwis
loewis at informatik.hu-berlin.de
Sat Dec 7 12:26:38 UTC 2002
"J. Stephen Adamczyk" <jsa at edg.com> writes:
> The return type of the conversion function might or might not
> take a template argument list, and the conversion function itself
> might or might not take an template argument list (it takes a
> template argument list if it's a member template).
It is important to observe that a conversion operator that is a member
template can only use this argument as its return type. As you can't
specify template arguments to such an operator explicitly, they must
have been obtained by template argument deduction, so the template
argument must occur in the return type.
> I haven't been able to come up with an example where two different
> functions produce the same mangled name, but the demangling ambiguity
> is there for sure.
I don't think there is an ambiguity. If there is a T.*_ in the
operator's name, it is a member template, if there is no T_, the
return type is an independently-instantiated (class) template.
In the former case, you can have one or two template argument lists;
in the latter case, you can have zero or one argument lists.
A demangler should probably operate as follows:
1. Check if there are two template argument lists. If so, the operator
is a template, and the return type is a template; demangle the first
list, replacing T_ with the single argument of the second list.
2. If there is only a single argument list, check whether the template
name is T_. If so, it is a member template; the return type is the template
argument.
3. Otherwise, the return type is a template instantiation.
Regards,
Martin
More information about the cxx-abi-dev
mailing list