Name-mangling for typename types
Mark Mitchell
mark at codesourcery.com
Thu Oct 3 21:04:30 UTC 2002
The ABI does not presently specify the mangling of the instantiation
of "f" in this case:
template <typename Q>
void f (typename Q::X) {}
struct S {
typedef int X;
};
template void f<S> (int);
The problem is that the <prefix> for the <nested-name> T::X is a
template parameter. The expansions for prefix to do not handle this
case correctly; the only applicable choice is <unqualified-name>.
That will result in this mangling for "f":
_Z1fI1SEvN1Q1XE
which is incorrect because the name of the template parameter (Q)
should not matter.
The fix is to add:
<prefix> ::= <template-parm>
This results in the mangling:
_Z1fI1SEvNT_1XE
which is better.
A similar issue arises for:
template <template <typename> class Q>
void f (typename Q<int>::X) {}
template <typename Q>
struct S {
typedef int X;
};
template void f<S> (int);
which should be fixed by adding:
<template-prefix> ::= <template-template-parm>
I will check in these chages shortly if nobody objects.
--
Mark Mitchell mark at codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
More information about the cxx-abi-dev
mailing list