public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17373] New: std::set::erase(const_iterator) doesn't output error on compilation
@ 2004-09-09 12:13 romainbehar at yahoo dot com
  2004-09-09 12:17 ` [Bug libstdc++/17373] " giovannibajo at libero dot it
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: romainbehar at yahoo dot com @ 2004-09-09 12:13 UTC (permalink / raw)
  To: gcc-bugs

The following instructions compile without any warning; tested using g++ 2.95,
3.3 and 3.4:

	std::set<int> vs;
	const std::set<int>::const_iterator i = vs.begin();
	vs.erase(i);

it should stop compilation with an error, such as:
" error: invalid conversion from `const int* const' to `int*' "

-- 
           Summary: std::set::erase(const_iterator) doesn't output error on
                    compilation
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: romainbehar at yahoo dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/17373] std::set::erase(const_iterator) doesn't output error on compilation
  2004-09-09 12:13 [Bug c++/17373] New: std::set::erase(const_iterator) doesn't output error on compilation romainbehar at yahoo dot com
@ 2004-09-09 12:17 ` giovannibajo at libero dot it
  2004-09-09 12:18 ` giovannibajo at libero dot it
  2004-09-09 12:18 ` giovannibajo at libero dot it
  2 siblings, 0 replies; 8+ messages in thread
From: giovannibajo at libero dot it @ 2004-09-09 12:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-09-09 12:17 -------
No, the code is OK. A const iterator cannot be used to directly modify the 
container, but you can pass it to erase() without any problems.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
          Component|c++                         |libstdc++
         Resolution|                            |INVALID


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/17373] std::set::erase(const_iterator) doesn't output error on compilation
  2004-09-09 12:13 [Bug c++/17373] New: std::set::erase(const_iterator) doesn't output error on compilation romainbehar at yahoo dot com
  2004-09-09 12:17 ` [Bug libstdc++/17373] " giovannibajo at libero dot it
@ 2004-09-09 12:18 ` giovannibajo at libero dot it
  2004-09-09 12:18 ` giovannibajo at libero dot it
  2 siblings, 0 replies; 8+ messages in thread
From: giovannibajo at libero dot it @ 2004-09-09 12:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-09-09 12:18 -------
*** Bug 17374 has been marked as a duplicate of this bug. ***

-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/17373] std::set::erase(const_iterator) doesn't output error on compilation
  2004-09-09 12:13 [Bug c++/17373] New: std::set::erase(const_iterator) doesn't output error on compilation romainbehar at yahoo dot com
  2004-09-09 12:17 ` [Bug libstdc++/17373] " giovannibajo at libero dot it
  2004-09-09 12:18 ` giovannibajo at libero dot it
@ 2004-09-09 12:18 ` giovannibajo at libero dot it
  2 siblings, 0 replies; 8+ messages in thread
From: giovannibajo at libero dot it @ 2004-09-09 12:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-09-09 12:18 -------
Also FYI notice that iterators are almost *never* implemented as raw pointers 
(they are objects which implements operator* and operator-> and acts like 
pointers).

-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/17373] std::set::erase(const_iterator) doesn't output error on compilation
       [not found] <bug-17373-9277@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2006-04-25 13:23 ` rguenth at gcc dot gnu dot org
@ 2006-04-25 13:33 ` pcarlini at suse dot de
  3 siblings, 0 replies; 8+ messages in thread
From: pcarlini at suse dot de @ 2006-04-25 13:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pcarlini at suse dot de  2006-04-25 13:33 -------
Yes, we are simply implementing the resolution of DR 103: set<>::iterator is a
constant iterator type


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/17373] std::set::erase(const_iterator) doesn't output error on compilation
       [not found] <bug-17373-9277@http.gcc.gnu.org/bugzilla/>
  2006-04-25 13:19 ` falk at debian dot org
  2006-04-25 13:20 ` falk at debian dot org
@ 2006-04-25 13:23 ` rguenth at gcc dot gnu dot org
  2006-04-25 13:33 ` pcarlini at suse dot de
  3 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-04-25 13:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2006-04-25 13:23 -------
  template<class _Key, class _Compare, class _Alloc>
    class set 
    {
...
      // _GLIBCXX_RESOLVE_LIB_DEFECTS
      // DR 103. set::iterator is required to be modifiable,
      // but this allows modification of keys.
      typedef typename _Rep_type::const_iterator            iterator;
      typedef typename _Rep_type::const_iterator            const_iterator;
      typedef typename _Rep_type::const_reverse_iterator    reverse_iterator;
      typedef typename _Rep_type::const_reverse_iterator   
const_reverse_iterator;

all iterators are const...


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/17373] std::set::erase(const_iterator) doesn't output error on compilation
       [not found] <bug-17373-9277@http.gcc.gnu.org/bugzilla/>
  2006-04-25 13:19 ` falk at debian dot org
@ 2006-04-25 13:20 ` falk at debian dot org
  2006-04-25 13:23 ` rguenth at gcc dot gnu dot org
  2006-04-25 13:33 ` pcarlini at suse dot de
  3 siblings, 0 replies; 8+ messages in thread
From: falk at debian dot org @ 2006-04-25 13:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from falk at debian dot org  2006-04-25 13:20 -------
(In reply to comment #4)
> The standard doesn't mention set::erase with "iterator" argument, only with
> "const_iterator".  

erm. the other way round, of course.


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/17373] std::set::erase(const_iterator) doesn't output error on compilation
       [not found] <bug-17373-9277@http.gcc.gnu.org/bugzilla/>
@ 2006-04-25 13:19 ` falk at debian dot org
  2006-04-25 13:20 ` falk at debian dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: falk at debian dot org @ 2006-04-25 13:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from falk at debian dot org  2006-04-25 13:19 -------
The standard doesn't mention set::erase with "iterator" argument, only with
"const_iterator". Maybe it is legal for g++ to allow it anyway (even if I
cannot find anything in the standard allowing it at the moment), but other
compilers don't, so it is a rather useless extension. So I'll reopen this
bug.


-- 

falk at debian dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-04-25 13:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-09 12:13 [Bug c++/17373] New: std::set::erase(const_iterator) doesn't output error on compilation romainbehar at yahoo dot com
2004-09-09 12:17 ` [Bug libstdc++/17373] " giovannibajo at libero dot it
2004-09-09 12:18 ` giovannibajo at libero dot it
2004-09-09 12:18 ` giovannibajo at libero dot it
     [not found] <bug-17373-9277@http.gcc.gnu.org/bugzilla/>
2006-04-25 13:19 ` falk at debian dot org
2006-04-25 13:20 ` falk at debian dot org
2006-04-25 13:23 ` rguenth at gcc dot gnu dot org
2006-04-25 13:33 ` pcarlini at suse dot de

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).