Actions

icon Post
text/html Subscribe
text/html Unsubscribe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mangling ambiguity


  • To: cxx-abi@xxxxxxxxxxxx
  • Subject: Mangling ambiguity
  • From: Matt Austern <austern@xxxxxxx>
  • Date: Fri, 28 Apr 2000 11:46:00 -0700 (PDT)

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