Mangling ambiguity

Daveed Vandevoorde daveed at edg.com
Fri Apr 28 19:06:47 UTC 2000


Matt Austern wrote:
[...]
>        template <class T> struct A { };
>        template <class T> struct B { };
> 
>        template <class T> struct X        { void f(T); };
>        template <class T> struct X<A<T> > { void f(T); };
> 
> Now consider how to mangle these instantiations:
>     void X<A<int> >::f(int);
>     void X<B<int> >::f(B<int> >);
> 
> Under our current rules, I claim that the latter is clearly
>     _Z N 1X I1BIiEE 1f E vT1_
> 
> How about the former?  It depends on how "multiple levels of template"
> is to be interpreted, and we could reasonably interpret it as saying
> either that the mangling should be
>     _Z N 1X I1AIiEE 1f E vT1_
> or that it should be
>     _Z N 1X I1AIiEE 1f E vT2_
> 
> We should clarify the rules to make sure we say that it's "T2_"
> instead of "T1_", because otherwise we'll have an ambiguity that can
> be resolved only by the demangler knowing whether or not it's dealing
> with a partial specialization.

I must be going blank, but where is the ambiguity with the first
mangling?  In the latter case, what does "T2_" refer to given that
there is only one template parameter?

	Daveed




More information about the cxx-abi-dev mailing list