c++/8964: 2 different templates mangled with the same name

catherin@ca.ibm.com catherin@ca.ibm.com
Mon Dec 16 11:56:00 GMT 2002


>Number:         8964
>Category:       c++
>Synopsis:       2 different templates mangled with the same name
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 16 11:56:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Catherine Morton
>Release:        g++ 3.2
>Organization:
>Environment:
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:
// -------- c.cpp ---------

struct bus{};
template < class T,int I > struct A
{
  typedef bus X;
};

template<class T> struct A<T,3>
{
  typedef char X;
};

template <template <class B,int I> class XX> void foo(typename XX<int,3>::X a){}
template <template <class B,int I> class XX> void foo(typename XX<int,4>::X a){}

int main()
{
  //A<int> x;
  struct bus test;
  foo<A>('x');   
  foo<A>(test);
}


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

g++ c.cpp

/nfs/protoss/home/catherin/tmp/ccjWv8pa.s: Assembler messages:
/nfs/protoss/home/catherin/tmp/ccjWv8pa.s:59: Error: symbol `_Z3fooI1AEvN2XX1XE' is already defined

template arguments for template template paramater XX
are not part of the mangled name
_Z3fooI1AEvN2XX1XE

So both instances of foo are mangled with the same name
>How-To-Repeat:
g++ c.cpp
>Fix:

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



More information about the Gcc-bugs mailing list