https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62169

            Bug ID: 62169
           Summary: map iterators under _GLIBCXX_DEBUG diverge
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: terra at gnome dot org

The two types
    std::map<int,int>::iterator
    std::map<const int,int>::iterator
are the same when compiled normally, but different under _GLIBCXX_DEBUG.

I actually don't know if the standard allows that, but if it does and the
difference is intentional, then the documentation ought to mention it.




welinder@sherwood:~> cat iterator.C
#include <iostream>
#include <map>

static int foo (const void *) { return 0; }
static int foo (std::map<int,int>::iterator *) { return 1; }

int
main ()
{
  std::cerr << foo (static_cast<std::map<const int,int>::iterator *> (0)) <<
std::endl;
  return 0;
}

welinder@sherwood:~> g++ iterator.C
welinder@sherwood:~> ./a.out 
1

welinder@sherwood:~> g++ -D_GLIBCXX_DEBUG iterator.C
welinder@sherwood:~> ./a.out 
0


welinder@sherwood:~> g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/4.8/lto-wrapper
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64
--enable-languages=c,c++,objc,fortran,obj-c++,java,ada
--enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.8
--enable-ssp --disable-libssp --disable-plugin
--with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux'
--disable-libgcj --disable-libmudflap --with-slibdir=/lib64 --with-system-zlib
--enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch
--enable-version-specific-runtime-libs --enable-linker-build-id
--program-suffix=-4.8 --enable-linux-futex --without-system-libunwind
--with-arch-32=i586 --with-tune=generic --build=x86_64-suse-linux
Thread model: posix
gcc version 4.8.1 20130909 [gcc-4_8-branch revision 202388] (SUSE Linux) 


(Preprocessed versions coming up, just in case.)

Reply via email to