This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/15523] New: Can't have vectors of vector::const_iterator


I definitely like the debug mode in libstdc++, but happened to fall over this: 
----------------- 
#include <vector> 
 
int main () 
{ 
  std::vector<std::vector<int>::const_iterator> x(2); 
} 
----------------- 
 
When compiled with -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC, I got this: 
 
homes/csm2/bangerth/bin/gcc-3.4.0/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/debug/safe_iterator.h:125: 
    error: attempt to copy-construct an iterator from a singular iterator. 
 
Objects involved in the operation: 
iterator "this" @ 0x0x8067ee0 { 
type = 
N11__gnu_debug14_Safe_iteratorIN9__gnu_cxx17__normal_iteratorIPKiN10__gnu_norm6vectorIiSaIiEEEEEN15__gnu_debug_def6vectorIiS7_EEEE 
(constant iterator); 
  state = singular; 
} 
iterator "other" @ 0x0xbfffdd40 { 
type = 
N11__gnu_debug14_Safe_iteratorIN9__gnu_cxx17__normal_iteratorIPKiN10__gnu_norm6vectorIiSaIiEEEEEN15__gnu_debug_def6vectorIiS7_EEEE 
(constant iterator); 
  state = singular; 
} 
 
 
For some reason, I fail to see why I shouldn't be allowed to copy-construct from an 
invalid iterator. After all, the result would still be invalid and couldn't be dereferenced, no? 
I think this should be allowed. 
 
W.

-- 
           Summary: Can't have vectors of vector::const_iterator
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bangerth at dealii dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]