public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52174] New: Implicit conversion of nullptr to bool
@ 2012-02-08 16:45 lsoltysiak at gmail dot com
2012-02-08 16:54 ` [Bug c++/52174] " redi at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: lsoltysiak at gmail dot com @ 2012-02-08 16:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52174
Bug #: 52174
Summary: Implicit conversion of nullptr to bool
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: trivial
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: lsoltysiak@gmail.com
Document 'A name for the null pointer: nullptr (revision 4)' states that
implicit conversion of nullptr to bool is not allowed. Unfortunately in g++
4.7.0, this requirement is not fulfilled. See example below.
if (nullptr) //shall return error, implicit conversion to bool not allowed
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/52174] Implicit conversion of nullptr to bool
2012-02-08 16:45 [Bug c++/52174] New: Implicit conversion of nullptr to bool lsoltysiak at gmail dot com
@ 2012-02-08 16:54 ` redi at gcc dot gnu.org
2012-02-08 16:55 ` redi at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2012-02-08 16:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52174
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-02-08 16:53:43 UTC ---
That document is not the standard, [conv.bool] says "A prvalue of type
std::nullptr_t can be converted to a prvalue of type bool; the resulting value
is false."
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/52174] Implicit conversion of nullptr to bool
2012-02-08 16:45 [Bug c++/52174] New: Implicit conversion of nullptr to bool lsoltysiak at gmail dot com
2012-02-08 16:54 ` [Bug c++/52174] " redi at gcc dot gnu.org
@ 2012-02-08 16:55 ` redi at gcc dot gnu.org
2012-02-08 18:05 ` [Bug c++/52174] [DR 1423] " redi at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2012-02-08 16:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52174
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-02-08 16:55:26 UTC ---
but N.B. http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1423
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/52174] [DR 1423] Implicit conversion of nullptr to bool
2012-02-08 16:45 [Bug c++/52174] New: Implicit conversion of nullptr to bool lsoltysiak at gmail dot com
2012-02-08 16:54 ` [Bug c++/52174] " redi at gcc dot gnu.org
2012-02-08 16:55 ` redi at gcc dot gnu.org
@ 2012-02-08 18:05 ` redi at gcc dot gnu.org
2012-07-20 18:58 ` daniel.kruegler at googlemail dot com
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2012-02-08 18:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52174
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |SUSPENDED
Last reconfirmed| |2012-02-08
Resolution|INVALID |
Summary|Implicit conversion of |[DR 1423] Implicit
|nullptr to bool |conversion of nullptr to
| |bool
Ever Confirmed|0 |1
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-02-08 18:05:19 UTC ---
that DR has been discussed by the committee today and it seems the rule will be
changed, so suspending
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/52174] [DR 1423] Implicit conversion of nullptr to bool
2012-02-08 16:45 [Bug c++/52174] New: Implicit conversion of nullptr to bool lsoltysiak at gmail dot com
` (2 preceding siblings ...)
2012-02-08 18:05 ` [Bug c++/52174] [DR 1423] " redi at gcc dot gnu.org
@ 2012-07-20 18:58 ` daniel.kruegler at googlemail dot com
2012-10-05 19:31 ` paolo.carlini at oracle dot com
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2012-07-20 18:58 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52174
Daniel Krügler <daniel.kruegler at googlemail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel.kruegler at
| |googlemail dot com
--- Comment #4 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-07-20 18:58:28 UTC ---
DR 1423 has now reached ready status,
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1423
so this seems like a good reason to consider a compiler change to evaluate
potential code breakages.
Here some recommended test-cases that should hold:
1)
bool b1 = nullptr; // Is well-formed today, needs to be ill-formed
2)
bool b2(nullptr); // well-formed today and under 1423
3)
template<class T>
T&& make();
template<class T>
void sink(T);
template<class T1, class T2,
class = decltype(sink<T2>(make<T1>()))
>
auto f(int) -> char(&)[1];
template<class, class>
auto f(...) -> char(&)[2];
static_assert(sizeof(f<decltype(nullptr), bool>(0)) != 1, "");
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/52174] [DR 1423] Implicit conversion of nullptr to bool
2012-02-08 16:45 [Bug c++/52174] New: Implicit conversion of nullptr to bool lsoltysiak at gmail dot com
` (3 preceding siblings ...)
2012-07-20 18:58 ` daniel.kruegler at googlemail dot com
@ 2012-10-05 19:31 ` paolo.carlini at oracle dot com
2014-06-03 3:52 ` paolo.carlini at oracle dot com
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-10-05 19:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52174
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|SUSPENDED |NEW
Severity|trivial |normal
--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-10-05 19:31:08 UTC ---
Unsuspending then.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/52174] [DR 1423] Implicit conversion of nullptr to bool
2012-02-08 16:45 [Bug c++/52174] New: Implicit conversion of nullptr to bool lsoltysiak at gmail dot com
` (4 preceding siblings ...)
2012-10-05 19:31 ` paolo.carlini at oracle dot com
@ 2014-06-03 3:52 ` paolo.carlini at oracle dot com
2014-06-03 17:49 ` paolo at gcc dot gnu.org
2014-06-03 17:50 ` paolo.carlini at oracle dot com
7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-06-03 3:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52174
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |paolo.carlini at oracle dot com
Target Milestone|--- |4.10.0
--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Mine.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/52174] [DR 1423] Implicit conversion of nullptr to bool
2012-02-08 16:45 [Bug c++/52174] New: Implicit conversion of nullptr to bool lsoltysiak at gmail dot com
` (5 preceding siblings ...)
2014-06-03 3:52 ` paolo.carlini at oracle dot com
@ 2014-06-03 17:49 ` paolo at gcc dot gnu.org
2014-06-03 17:50 ` paolo.carlini at oracle dot com
7 siblings, 0 replies; 9+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-06-03 17:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52174
--- Comment #7 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Tue Jun 3 17:48:36 2014
New Revision: 211195
URL: http://gcc.gnu.org/viewcvs?rev=211195&root=gcc&view=rev
Log:
gcc/cp
2014-06-03 Paolo Carlini <paolo.carlini@oracle.com>
DR 1423
PR c++/52174
* call.c (standard_conversion): Convert nullptr to bool only
in case of direct-initialization.
(convert_like_real): Provide informative error message.
gcc/testsuite
2014-06-03 Paolo Carlini <paolo.carlini@oracle.com>
DR 1423
PR c++/52174
* g++.dg/cpp0x/nullptr31.C: New.
* g++.dg/cpp0x/sfinae-nullptr1.C: Likewise.
* g++.dg/cpp0x/nullptr17.C: Update.
libstdc++-v3
2014-06-03 Paolo Carlini <paolo.carlini@oracle.com>
DR 1423
PR c++/52174
* testsuite/20_util/is_assignable/value.cc: Update.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/nullptr31.C
trunk/gcc/testsuite/g++.dg/cpp0x/sfinae-nullptr1.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/cpp0x/nullptr17.C
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/testsuite/20_util/is_assignable/value.cc
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/52174] [DR 1423] Implicit conversion of nullptr to bool
2012-02-08 16:45 [Bug c++/52174] New: Implicit conversion of nullptr to bool lsoltysiak at gmail dot com
` (6 preceding siblings ...)
2014-06-03 17:49 ` paolo at gcc dot gnu.org
@ 2014-06-03 17:50 ` paolo.carlini at oracle dot com
7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-06-03 17:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52174
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Assignee|paolo.carlini at oracle dot com |unassigned at gcc dot gnu.org
--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed for 4.10.0.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-06-03 17:50 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-08 16:45 [Bug c++/52174] New: Implicit conversion of nullptr to bool lsoltysiak at gmail dot com
2012-02-08 16:54 ` [Bug c++/52174] " redi at gcc dot gnu.org
2012-02-08 16:55 ` redi at gcc dot gnu.org
2012-02-08 18:05 ` [Bug c++/52174] [DR 1423] " redi at gcc dot gnu.org
2012-07-20 18:58 ` daniel.kruegler at googlemail dot com
2012-10-05 19:31 ` paolo.carlini at oracle dot com
2014-06-03 3:52 ` paolo.carlini at oracle dot com
2014-06-03 17:49 ` paolo at gcc dot gnu.org
2014-06-03 17:50 ` paolo.carlini at oracle dot com
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).