public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/23781] New: Implicit conversion from NULL to list<T>::iterator
@ 2005-09-08 15:55 Marc dot Boyer at enseeiht dot fr
2005-09-08 17:30 ` [Bug libstdc++/23781] " pinskia at gcc dot gnu dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Marc dot Boyer at enseeiht dot fr @ 2005-09-08 15:55 UTC (permalink / raw)
To: gcc-bugs
This code compiles, and should not.
#include <list>
int main( ) {
std::list< float >::iterator l_it= NULL ;
}
Replacing list per vector, it does no more compile, which is a better result.
I am not a C++ expert, but after a short reading of the slt_list.h file,
I guess that the problem is thet there is a constructor of a base class of
list<>::iterator that is not "explicit".
--
Summary: Implicit conversion from NULL to list<T>::iterator
Product: gcc
Version: 3.3.5
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: Marc dot Boyer at enseeiht dot fr
CC: gcc-bugs at gcc dot gnu dot org,gdr at gcc dot gnu dot
org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23781
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/23781] Implicit conversion from NULL to list<T>::iterator
2005-09-08 15:55 [Bug libstdc++/23781] New: Implicit conversion from NULL to list<T>::iterator Marc dot Boyer at enseeiht dot fr
@ 2005-09-08 17:30 ` pinskia at gcc dot gnu dot org
2005-09-08 20:55 ` gdr at integrable-solutions dot net
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-08 17:30 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-09-08 17:30 -------
Note ICC also accepts this code too.
--
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |2.95.3 4.0.0 3.0.4 3.2.3
| |3.0.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23781
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/23781] Implicit conversion from NULL to list<T>::iterator
2005-09-08 15:55 [Bug libstdc++/23781] New: Implicit conversion from NULL to list<T>::iterator Marc dot Boyer at enseeiht dot fr
2005-09-08 17:30 ` [Bug libstdc++/23781] " pinskia at gcc dot gnu dot org
@ 2005-09-08 20:55 ` gdr at integrable-solutions dot net
2005-09-08 21:06 ` pcarlini at suse dot de
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: gdr at integrable-solutions dot net @ 2005-09-08 20:55 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at integrable-solutions dot net 2005-09-08 20:55 -------
Subject: Re: Implicit conversion from NULL to list<T>::iterator
"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:
| Note ICC also accepts this code too.
yes, but that is irrelevant.
We don't accept
#include <vector>
#include <string>
int main()
{
using namespace std;
vector<string>::iterator p = NULL;
}
for proper type checking. The list iterator constructor accepting a
pointer should be explicit.
Thanks Marc,
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23781
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/23781] Implicit conversion from NULL to list<T>::iterator
2005-09-08 15:55 [Bug libstdc++/23781] New: Implicit conversion from NULL to list<T>::iterator Marc dot Boyer at enseeiht dot fr
2005-09-08 17:30 ` [Bug libstdc++/23781] " pinskia at gcc dot gnu dot org
2005-09-08 20:55 ` gdr at integrable-solutions dot net
@ 2005-09-08 21:06 ` pcarlini at suse dot de
2005-09-08 21:11 ` pcarlini at suse dot de
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pcarlini at suse dot de @ 2005-09-08 21:06 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pcarlini at suse dot de 2005-09-08 21:06 -------
(In reply to comment #2)
> We don't accept
>
> #include <vector>
> #include <string>
>
> int main()
> {
> using namespace std;
> vector<string>::iterator p = NULL;
> }
>
> for proper type checking. The list iterator constructor accepting a
> pointer should be explicit.
Agreed. Likewise for deque::iterator, I suppose. I will work on this.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pcarlini at suse dot de
|dot org |
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2005-09-08 21:06:28
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23781
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/23781] Implicit conversion from NULL to list<T>::iterator
2005-09-08 15:55 [Bug libstdc++/23781] New: Implicit conversion from NULL to list<T>::iterator Marc dot Boyer at enseeiht dot fr
` (2 preceding siblings ...)
2005-09-08 21:06 ` pcarlini at suse dot de
@ 2005-09-08 21:11 ` pcarlini at suse dot de
2005-09-08 22:47 ` gdr at integrable-solutions dot net
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pcarlini at suse dot de @ 2005-09-08 21:11 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pcarlini at suse dot de 2005-09-08 21:11 -------
(In reply to comment #3)
> Agreed. Likewise for deque::iterator, I suppose. I will work on this.
I meant set::iterator and map::iterator, actually: checked earlier today
and forgot that deque is not affected. Anyway, consistency with the
behavior of vector.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23781
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/23781] Implicit conversion from NULL to list<T>::iterator
2005-09-08 15:55 [Bug libstdc++/23781] New: Implicit conversion from NULL to list<T>::iterator Marc dot Boyer at enseeiht dot fr
` (3 preceding siblings ...)
2005-09-08 21:11 ` pcarlini at suse dot de
@ 2005-09-08 22:47 ` gdr at integrable-solutions dot net
2005-09-11 9:48 ` cvs-commit at gcc dot gnu dot org
2005-09-11 9:52 ` pcarlini at suse dot de
6 siblings, 0 replies; 8+ messages in thread
From: gdr at integrable-solutions dot net @ 2005-09-08 22:47 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at integrable-solutions dot net 2005-09-08 22:47 -------
Subject: Re: Implicit conversion from NULL to list<T>::iterator
"pcarlini at suse dot de" <gcc-bugzilla@gcc.gnu.org> writes:
| Agreed. Likewise for deque::iterator, I suppose. I will work on this.
Thank you much Paolo.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23781
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/23781] Implicit conversion from NULL to list<T>::iterator
2005-09-08 15:55 [Bug libstdc++/23781] New: Implicit conversion from NULL to list<T>::iterator Marc dot Boyer at enseeiht dot fr
` (4 preceding siblings ...)
2005-09-08 22:47 ` gdr at integrable-solutions dot net
@ 2005-09-11 9:48 ` cvs-commit at gcc dot gnu dot org
2005-09-11 9:52 ` pcarlini at suse dot de
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-09-11 9:48 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-09-11 09:48 -------
Subject: Bug 23781
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: paolo@gcc.gnu.org 2005-09-11 09:48:41
Modified files:
libstdc++-v3 : ChangeLog
libstdc++-v3/include/ext: slist
libstdc++-v3/include/tr1: hashtable array
libstdc++-v3/include/bits: list.tcc stl_list.h stl_tree.h
libstdc++-v3/testsuite/23_containers/map/operators: 1_neg.cc
libstdc++-v3/testsuite/23_containers/set/operators: 1_neg.cc
Added files:
libstdc++-v3/testsuite/ext/slist: 23781.cc
libstdc++-v3/testsuite/tr1/6_containers/unordered: 23781.cc
libstdc++-v3/testsuite/23_containers/list: 23781.cc
libstdc++-v3/testsuite/23_containers/map: 23781.cc
libstdc++-v3/testsuite/23_containers/multimap: 23781.cc
libstdc++-v3/testsuite/23_containers/multiset: 23781.cc
libstdc++-v3/testsuite/23_containers/set: 23781.cc
Log message:
2005-09-11 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/23781
* include/bits/stl_list.h (_List_iterator<>::
_List_iterator(_List_node_base*), _List_const_iterator<>::
_List_const_iterator(const _List_node_base*)): Make explicit.
(list<>::begin(), list<>::end(), list<>::pop_back()): Adjust
consistently.
* include/bits/list.tcc (list<>::insert, list<>::erase): Adjust
consistently.
* include/bits/stl_tree.h (_Rb_tree_iterator<>::
_Rb_tree_iterator(_Link_type), _Rb_tree_const_iterator<>::
_Rb_tree_const_iterator(_Link_type)): Make explicit.
(_Rb_tree<>::begin(), _Rb_tree<>::end()): Adjust consistently.
* include/ext/slist (_Slist_iterator<>::_Slist_iterator(_Node*)):
Make explicit.
(slist<>::erase(iterator), slist<>::erase(iterator, iterator)):
Adjust consistently.
* include/tr1/hashtable (hashtable_iterator<>::
hashtable_iterator(hash_node<>**)): Make explicit.
* testsuite/23_containers/list/23781.cc: New.
* testsuite/23_containers/map/23781.cc: Likewise.
* testsuite/23_containers/multimap/23781.cc: Likewise.
* testsuite/23_containers/multiset/23781.cc: Likewise.
* testsuite/23_containers/set/23781.cc: Likewise.
* testsuite/ext/slist/23781.cc: Likewise.
* testsuite/tr1/6_containers/unordered/23781.cc: Likewise.
* testsuite/23_containers/map/operators/1_neg.cc: Adjust dg-error
line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Likewise.
* include/tr1/array (array<>::begin(), array<>::end()): Adjust
stylistically for consistency with the other containers.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.3094&r2=1.3095
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/ext/slist.diff?cvsroot=gcc&r1=1.27&r2=1.28
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/tr1/hashtable.diff?cvsroot=gcc&r1=1.8&r2=1.9
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/tr1/array.diff?cvsroot=gcc&r1=1.7&r2=1.8
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/ext/slist/23781.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/tr1/6_containers/unordered/23781.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/list.tcc.diff?cvsroot=gcc&r1=1.21&r2=1.22
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/stl_list.h.diff?cvsroot=gcc&r1=1.51&r2=1.52
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/stl_tree.h.diff?cvsroot=gcc&r1=1.47&r2=1.48
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/23_containers/list/23781.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/23_containers/map/23781.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/23_containers/map/operators/1_neg.cc.diff?cvsroot=gcc&r1=1.7&r2=1.8
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/23_containers/multimap/23781.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/23_containers/multiset/23781.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/23_containers/set/23781.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/23_containers/set/operators/1_neg.cc.diff?cvsroot=gcc&r1=1.7&r2=1.8
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23781
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/23781] Implicit conversion from NULL to list<T>::iterator
2005-09-08 15:55 [Bug libstdc++/23781] New: Implicit conversion from NULL to list<T>::iterator Marc dot Boyer at enseeiht dot fr
` (5 preceding siblings ...)
2005-09-11 9:48 ` cvs-commit at gcc dot gnu dot org
@ 2005-09-11 9:52 ` pcarlini at suse dot de
6 siblings, 0 replies; 8+ messages in thread
From: pcarlini at suse dot de @ 2005-09-11 9:52 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pcarlini at suse dot de 2005-09-11 09:52 -------
Fixed for 4.1.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23781
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-09-11 9:52 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-08 15:55 [Bug libstdc++/23781] New: Implicit conversion from NULL to list<T>::iterator Marc dot Boyer at enseeiht dot fr
2005-09-08 17:30 ` [Bug libstdc++/23781] " pinskia at gcc dot gnu dot org
2005-09-08 20:55 ` gdr at integrable-solutions dot net
2005-09-08 21:06 ` pcarlini at suse dot de
2005-09-08 21:11 ` pcarlini at suse dot de
2005-09-08 22:47 ` gdr at integrable-solutions dot net
2005-09-11 9:48 ` cvs-commit at gcc dot gnu dot org
2005-09-11 9:52 ` 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).