public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "llewelly at xmission dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/15523] Can't have vectors of vector::const_iterator
Date: Wed, 19 May 2004 23:07:00 -0000	[thread overview]
Message-ID: <20040519051117.10741.qmail@sourceware.org> (raw)
In-Reply-To: <20040518193757.15523.bangerth@dealii.org>


------- Additional Comments From llewelly at xmission dot com  2004-05-19 05:11 -------
Subject: Re:  New: Can't have vectors of vector::const_iterator

"bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes:

> 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?

Copying an invalid iterator is undefined behavior. 24.1/5 .

> I think this should be allowed. 

Is there a gcc target where (a) loading an invalid address into an
    address register causes a hardware fault, and (b) copy
    constructing an invalid iterator might require such a load?


-- 


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


  parent reply	other threads:[~2004-05-19  5:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-19 12:25 [Bug libstdc++/15523] New: " bangerth at dealii dot org
2004-05-19 13:00 ` [Bug libstdc++/15523] " pinskia at gcc dot gnu dot org
2004-05-19 22:58 ` [Bug libstdc++/15523] New: " llewelly
2004-05-19 23:07 ` llewelly at xmission dot com [this message]
2004-05-20 15:16 ` [Bug libstdc++/15523] " bangerth at dealii dot org
2004-05-20 18:43   ` llewelly
2004-05-20 18:43 ` llewelly at xmission dot com
2004-05-20 18:43 ` bangerth at ices dot utexas dot edu
2004-05-20 18:43   ` llewelly
2004-05-20 18:43 ` sebor at roguewave dot com
2004-05-21  6:17   ` llewelly
2004-05-20 18:43 ` llewelly at xmission dot com
2004-05-20 19:27 ` bangerth at ices dot utexas dot edu
2004-05-21  9:21 ` llewelly at xmission dot com
2004-05-25 14:33 ` bkoz at gcc dot gnu dot org
2004-06-20  6:53 ` [Bug libstdc++/15523] [DR 408] " pinskia at gcc dot gnu dot org
2004-06-20  6:53 ` pinskia at gcc dot gnu dot org
2005-01-13 13:30 ` polzin_spamprotect_ at gmx dot de

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040519051117.10741.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).