http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48206

           Summary: Issue with using std::shared_ptr with custom equality
                    operator and STL (gnu++0x)
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: comadd...@gmx.net


Hi

I'm not 100% sure if this is actually an issue with gcc. It might be with boost
(or even more likely my understanding of c++ :) ) but from what I could gather
it seems that when using std::shared_ptr together with a overloaded equality
operator and a std::list the behavior of the equality operator of shared_ptr is
not what it should be considering the source code.

It seems that even though the equality operator of shared_ptr should compare
the underlying objects the program compiled by gcc compares the memory
addresses.

I'm using:
gcc:
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: /build/src/gcc-4.5-20110127/configure --prefix=/usr
--enable-languages=c,c++,fortran,objc,obj-c++,ada --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
--enable-gnu-unique-object --enable-lto --enable-plugin --enable-gold
--with-plugin-ld=ld.gold --disable-multilib --disable-libstdcxx-pch
--with-system-zlib --with-ppl --with-cloog
--with-cloog-include=/usr/include/cloog-ppl --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
Thread model: posix
gcc version 4.5.2 20110127 (prerelease) (GCC)

system:
Linux firebird 2.6.37-ARCH #1 SMP PREEMPT Tue Mar 8 08:08:06 UTC 2011 i686 AMD
Athlon(tm) 64 X2 Dual Core Processor 4800+ AuthenticAMD GNU/Linux

command line:
g++ -g -O0 -std=gnu++0x test.cpp

compiler output:
none

A sample program which shows the issue is attached as test.ii

I would expect the attached sample program to finish with "Success" and not
throw an exception.

If this is not a gcc bug I apologize and kindly ask if you could point my to
the right forum to readdress this issue.

Best regards
Cornelius

Reply via email to