[Bug libstdc++/42925] Not possible to compare unique_ptr with 0

2010-08-10 Thread redi at gcc dot gnu dot org
--- Comment #13 from redi at gcc dot gnu dot org 2010-08-11 00:15 --- Yes, I agree. I think it would be good to add the overloads, they can always be adjusted before 4.6 if they don't match the wording Alisdair proposes. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42925

[Bug libstdc++/42925] Not possible to compare unique_ptr with 0

2010-08-10 Thread paolo dot carlini at oracle dot com
--- Comment #12 from paolo dot carlini at oracle dot com 2010-08-10 23:48 --- Jon, is this actually GB 99? Trivially adding something like (& co, likewise for shared_ptr): template inline bool operator!=(const unique_ptr<_Tp, _Tp_Deleter>& __x, nullptr_t) { return __x.get

[Bug libstdc++/42925] Not possible to compare unique_ptr with 0

2010-02-01 Thread paolo dot carlini at oracle dot com
--- Comment #11 from paolo dot carlini at oracle dot com 2010-02-02 01:04 --- Ok, I guess we can close this. -- paolo dot carlini at oracle dot com changed: What|Removed |Added --

[Bug libstdc++/42925] Not possible to compare unique_ptr with 0

2010-02-01 Thread paolo dot carlini at oracle dot com
--- Comment #10 from paolo dot carlini at oracle dot com 2010-02-01 19:40 --- I see. In principle I think the user would like to see only operator!=(int, int) and indeed: template bool operator!=(const unique_ptr<_Tp, _Tp_Deleter>&, const unique_ptr<_Up, _

[Bug libstdc++/42925] Not possible to compare unique_ptr with 0

2010-02-01 Thread jason at gcc dot gnu dot org
--- Comment #9 from jason at gcc dot gnu dot org 2010-02-01 19:31 --- It does seem like it would be helpful to include templates in the list of all candidates. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42925

[Bug libstdc++/42925] Not possible to compare unique_ptr with 0

2010-02-01 Thread paolo dot carlini at oracle dot com
--- Comment #8 from paolo dot carlini at oracle dot com 2010-02-01 17:39 --- Let's keep this open for one sec, in case Jason believes that list of candidates could be actually made less confusing to the user. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42925

[Bug libstdc++/42925] Not possible to compare unique_ptr with 0

2010-02-01 Thread paolo dot carlini at oracle dot com
--- Comment #7 from paolo dot carlini at oracle dot com 2010-02-01 17:38 --- Ok, agreed... -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42925

[Bug libstdc++/42925] Not possible to compare unique_ptr with 0

2010-02-01 Thread jwakely dot gcc at gmail dot com
--- Comment #6 from jwakely dot gcc at gmail dot com 2010-02-01 17:36 --- (In reply to comment #5) > Jon, is there a thread on the reflector about related issues? I spotted > something but couldn't exactly remember... LWG 834 is about comparing unique_ptr::pointer to nullptr_t LWG 130

[Bug libstdc++/42925] Not possible to compare unique_ptr with 0

2010-02-01 Thread paolo dot carlini at oracle dot com
--- Comment #5 from paolo dot carlini at oracle dot com 2010-02-01 17:25 --- Jon, is there a thread on the reflector about related issues? I spotted something but couldn't exactly remember... Anyway, just want to add that I do not see why the C++ front-end, for some reason, decides to

[Bug libstdc++/42925] Not possible to compare unique_ptr with 0

2010-02-01 Thread jwakely dot gcc at gmail dot com
--- Comment #4 from jwakely dot gcc at gmail dot com 2010-02-01 17:22 --- there is this comparison function: template bool operator!=(const unique_ptr& x, const unique_ptr& y); What should T2 and D2 be deduced as, in the conversion from nullptr_t to unique_ptr ? Or to put it another

[Bug libstdc++/42925] Not possible to compare unique_ptr with 0

2010-02-01 Thread gcc at magfr dot user dot lysator dot liu dot se
--- Comment #3 from gcc at magfr dot user dot lysator dot liu dot se 2010-02-01 17:19 --- I think the code is valid. The unique_ptr(nullptr_t) constructor should take the 0 and build an empty unique_ptr object that is compared with ptr. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?i

[Bug libstdc++/42925] Not possible to compare unique_ptr with 0

2010-02-01 Thread jwakely dot gcc at gmail dot com
--- Comment #2 from jwakely dot gcc at gmail dot com 2010-02-01 17:01 --- I think the code is invalid. In 4.4 the expression (ptr != 0) converted ptr to an unspecified-bool-type and compared that to 0. In 4.5 the impicit conversion has been removed, and you need to say static_cast(ptr)

[Bug libstdc++/42925] Not possible to compare unique_ptr with 0

2010-02-01 Thread gcc at magfr dot user dot lysator dot liu dot se
--- Comment #1 from gcc at magfr dot user dot lysator dot liu dot se 2010-02-01 16:47 --- Created an attachment (id=19774) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19774&action=view) Test case demonstrating the problem. compile with g++ -std=c++0x -c test.cpp to demonstrat