[cxx-abi-dev] A mangling ambiguity

Mark Mitchell mark at codesourcery.com
Wed Dec 4 05:31:37 UTC 2002



--On Tuesday, December 03, 2002 02:25:59 PM -0500 "J. Stephen Adamczyk" 
<jsa at edg.com> wrote:

> Here's an interesting case that shows an ambiguity problem with name
> mangling:
>
> template <class T> struct A {
>   template <class U> operator U() { return 0; }
> };
> int main() {
>   A<float> a;
>   int i = a;
> }
>
> The mangled name for the conversion function is
>
> _ZN1AIfEcvT_IiEEv
>             ^problem here

The key question is:

  Is this just an ambiguity when demangling, or are there actually two
  distinct entities that could end up with the same name?

If the latter, we have to do something; if the former, we can probably
live with it. I can't quite figure out the answer; conversion functions
are a special case, and they are always members, so it may be that
everything after "cv" and before the next non-nested "E" must always
be a type, and then (optionally) some template arguments.

For example, in this case, it can't be a template template parameter
because then you hit the non-nested "E" without having gotten to the
argument that correspond to the template template parameter.

-- 
Mark Mitchell                mark at codesourcery.com
CodeSourcery, LLC            http://www.codesourcery.com



More information about the cxx-abi-dev mailing list