c++/9450: incorrect mangled name for scope resolution template argument

catherin@ca.ibm.com catherin@ca.ibm.com
Mon Jan 27 16:06:00 GMT 2003


>Number:         9450
>Category:       c++
>Synopsis:       incorrect mangled name for scope resolution template argument
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 27 14:56:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Catherine Morton
>Release:        3.2
>Organization:
>Environment:
gcc -v
Reading specs from /usr/lib/gcc-lib/powerpc-suse-linux/3.2/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --enable-languages=c,c++,f77,objc,java,ada --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit powerpc-suse-linux
Thread model: posix
gcc version 3.2
>Description:
testcase:
// ------- abc.cpp ------

struct A5 {int i;};
template <int A5::*p> void f5(int) {}
void g5() {f5<&A5::i>(0);}

// ----------------------

gcc name:
_Z2f5IXadsr2A5NS0_1iEEEvi

from ABI:
Template arguments that could be pointer-to-member constants are difficult because it is often 
not possible to distinguish them from pointers to static member functions or data members without 
doing the substitution. Therefore, the scope resolution (sr) mangling operator is used if the LHS 
operand of :: involves a template parameter. Ignoring substitutions, &T::j as a template argument 
would be encoded Xadsr1T1jE.

I don't think the gcc name is correct in this case:

_Z2f5IXadsr2A5NS0_1iEEEvi
              ^
The N here indicates that &A5::i is encoded  as "adsr" followed by 2A5 followed by the nested
name  A5::i encoded as (N2A51iE) NS0_i  (where S0_ is a substitution for the previously encoded 2A5)

So, I think that A5 is encoded 2 times in this name.

The abi example indicates that this context should not be
encoded as a nested name, so I'm guessing the correct name
should be:
_Z2f5IXadsr2A51iEEvi

so <&A5::i>  is   'IXadsr2A51iEE'

>How-To-Repeat:
g++ -c abc.cpp
nm abc.o

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list