A mangling ambiguity
J. Stephen Adamczyk
jsa at edg.com
Tue Dec 3 19:25:59 UTC 2002
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
At the indicated point, the result type of the conversion function ("T_")
should end, and the template argument list that follows ("IiE") should
apply to the conversion function itself, not to its return type.
There's no way for a demangler to know that, however, and it happily
takes the template argument list as part of the type, presumably in
this case as a template argument list for a template template parameter.
This is illustrated by what the g++ demangler does with this name:
A<float>::operator float<int>()
This seems like a genuine ambiguity. Or does someone see an out I'm
missing?
Steve Adamczyk
Edison Design Group
More information about the cxx-abi-dev
mailing list