Mangling ambiguity
Matt Austern
austern at sgi.com
Fri Apr 28 18:46:00 UTC 2000
We discussed this yesterday at the meeting. I'm just sending it out
to the list so everyone can see a simple example and comment on it.
Consider the following declarations:
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.
--Matt
More information about the cxx-abi-dev
mailing list