http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51121
Bug #: 51121 Summary: Duplicate destructors Classification: Unclassified Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: d...@mm.st g++ generates bad assembly for this code: ------------------------------- #include <decimal/decimal> #include <map> #include <string> using std::decimal::decimal32; int main( int, char ** ) { std::multimap< decimal32, std::pair< std::string, decimal32 > > m; decimal32 d1; std::string str; decimal32 d2; m.insert( std::make_pair( d1, std::make_pair( str, d2 ))); return 0; } ------------------------------- Specifically, it says $ g++ -c multimap_decimal.cpp /tmp/cc2sQism.s: Assembler messages: /tmp/cc2sQism.s:1690: Error: symbol `_ZNSt4pairIDfS_ISsDfEED2Ev' is already defined That symbol is the destructor for std::pair< decimal32, std::pair< std::string, decimal32 > >. It seems that g++ is instatiating a destructor for that type and with the first decimal32 replaced with const decimal32 and giving both the same mangled name. So it works if I change the m.insert() line to std::pair< const decimal32, std::pair< std::string, decimal32 > > p( d1, std::make_pair( str, d2 )); m.insert( p ); .ii file attached. $ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6.1/lto-wrapper Target: i686-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.1-9ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu Thread model: posix gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)