This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Really obscure C++ mangling error with -fnew-abi
"Martin v. Loewis" <martin@loewis.home.cs.tu-berlin.de> writes:
Martin> Given
Martin> struct s {
Martin> struct m{};
Martin> template<class T> void m(struct m) {}
Martin> };
Martin> int main() {
Martin> s x;
Martin> struct s::m M;
Martin> x.template m<int>(M);
Martin> }
Martin> the current g++ emits (under new ABI) _ZN1s1mIiEEvNS_1mE,
Martin> which is 'void s::m<int>(s::m)'. Based on your description,
Martin> I'd say that ::s::m is a substitution candidate, so it
Martin> should be '_ZN1s1mIiEEvS0', right?
This is a bit fuzzy, I think. The spec currently says,
All substitutions are for entities that would appear in a symbol
table.
That defines the mangling in implementation-specific terms, but it
would seem to me to imply that the struct name s::m is distinct from
the template name s::m, and therefore one cannot be substituted for
another. So, the next best thing (i.e. next longest prefix) is to
substitute for the struct name s.
Do you read it similarly?
Regards
Alex Samuel
CodeSourcery LLC