[cxx-abi-dev] A mangling ambiguity

Gabriel Dos Reis Gabriel.Dos-Reis at cmla.ens-cachan.fr
Wed Dec 4 16:06:02 UTC 2002


Mark Mitchell <mark at codesourcery.com> writes:

| --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.

Hmm, maybe I'm being dense but how is the latter really different from
the former?  If the names ot two entities end up being being mangled
the same, then there will be an ambiguity in demangling them.  No?

Conversely, if demangling a mangled named shows an ambiguity then that
means we can't determine the original entity name.  No?

| 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.

-- Gaby



More information about the cxx-abi-dev mailing list