public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/48420] New: Missed -Wconversion-null warning when passing const bool to T*
@ 2011-04-02 21:38 jyasskin at gcc dot gnu.org
  2011-09-28 20:14 ` [Bug c++/48420] " paolo.carlini at oracle dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: jyasskin at gcc dot gnu.org @ 2011-04-02 21:38 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Missed -Wconversion-null warning when passing const
                    bool to T*
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jyasskin@gcc.gnu.org


$ g++-mp-4.6 -Wconversion-null -c test.cc
dhcp-172-19-248-71:~/tmp$ cat test.cc
void foo(int* p);

void bar() {
    const bool kDebugMode = false;  // NULL pointer constant.
    foo(kDebugMode);  // But no warning!
}
$ g++-mp-4.6 -Wconversion-null -c test.cc
$ 

Changing the kDebugMode to 'false' or a false expression involving an enum
triggers the warning.


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

* [Bug c++/48420] Missed -Wconversion-null warning when passing const bool to T*
  2011-04-02 21:38 [Bug c++/48420] New: Missed -Wconversion-null warning when passing const bool to T* jyasskin at gcc dot gnu.org
@ 2011-09-28 20:14 ` paolo.carlini at oracle dot com
  2011-09-28 20:40 ` paolo.carlini at oracle dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-09-28 20:14 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-09-28
     Ever Confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-09-28 20:03:34 UTC ---
Interestingly, in C++0x mode it works, obviously thanks to the work on
constexpr. Do you really want it for C++98 too? ;)


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

* [Bug c++/48420] Missed -Wconversion-null warning when passing const bool to T*
  2011-04-02 21:38 [Bug c++/48420] New: Missed -Wconversion-null warning when passing const bool to T* jyasskin at gcc dot gnu.org
  2011-09-28 20:14 ` [Bug c++/48420] " paolo.carlini at oracle dot com
@ 2011-09-28 20:40 ` paolo.carlini at oracle dot com
  2011-11-03  1:19 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-09-28 20:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-09-28 20:05:32 UTC ---
Oops, sorry, got confused, in C++0x it's an hard error. Uhmmm.


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

* [Bug c++/48420] Missed -Wconversion-null warning when passing const bool to T*
  2011-04-02 21:38 [Bug c++/48420] New: Missed -Wconversion-null warning when passing const bool to T* jyasskin at gcc dot gnu.org
  2011-09-28 20:14 ` [Bug c++/48420] " paolo.carlini at oracle dot com
  2011-09-28 20:40 ` paolo.carlini at oracle dot com
@ 2011-11-03  1:19 ` paolo.carlini at oracle dot com
  2011-11-04 16:32 ` paolo at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-11-03  1:19 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |paolo.carlini at oracle dot
                   |gnu.org                     |com

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-11-03 01:19:36 UTC ---
On it.


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

* [Bug c++/48420] Missed -Wconversion-null warning when passing const bool to T*
  2011-04-02 21:38 [Bug c++/48420] New: Missed -Wconversion-null warning when passing const bool to T* jyasskin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-11-03  1:19 ` paolo.carlini at oracle dot com
@ 2011-11-04 16:32 ` paolo at gcc dot gnu.org
  2011-11-04 16:36 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo at gcc dot gnu.org @ 2011-11-04 16:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2011-11-04 16:31:23 UTC ---
Author: paolo
Date: Fri Nov  4 16:31:18 2011
New Revision: 180963

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180963
Log:
/cp
2011-11-04  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/48420
    * call.c (conversion_null_warnings): For 'false' to NULL pointer,
    just check that TREE_TYPE (expr) is a BOOLEAN_TYPE.

/testsuite
2011-11-04  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/48420
    * g++.dg/warn/Wconversion-null-3.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/warn/Wconversion-null-3.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/48420] Missed -Wconversion-null warning when passing const bool to T*
  2011-04-02 21:38 [Bug c++/48420] New: Missed -Wconversion-null warning when passing const bool to T* jyasskin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2011-11-04 16:32 ` paolo at gcc dot gnu.org
@ 2011-11-04 16:36 ` paolo.carlini at oracle dot com
  2011-12-13 20:05 ` redi at gcc dot gnu.org
  2012-05-03  1:35 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-11-04 16:36 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-11-04 16:32:51 UTC ---
Fixed for 4.7.0.


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

* [Bug c++/48420] Missed -Wconversion-null warning when passing const bool to T*
  2011-04-02 21:38 [Bug c++/48420] New: Missed -Wconversion-null warning when passing const bool to T* jyasskin at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2011-11-04 16:36 ` paolo.carlini at oracle dot com
@ 2011-12-13 20:05 ` redi at gcc dot gnu.org
  2012-05-03  1:35 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2011-12-13 20:05 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tutufan at gmail dot com

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-12-13 19:59:38 UTC ---
*** Bug 51531 has been marked as a duplicate of this bug. ***


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

* [Bug c++/48420] Missed -Wconversion-null warning when passing const bool to T*
  2011-04-02 21:38 [Bug c++/48420] New: Missed -Wconversion-null warning when passing const bool to T* jyasskin at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2011-12-13 20:05 ` redi at gcc dot gnu.org
@ 2012-05-03  1:35 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-05-03  1:35 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hub at figuiere dot net

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-05-03 01:35:04 UTC ---
*** Bug 53207 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2012-05-03  1:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-02 21:38 [Bug c++/48420] New: Missed -Wconversion-null warning when passing const bool to T* jyasskin at gcc dot gnu.org
2011-09-28 20:14 ` [Bug c++/48420] " paolo.carlini at oracle dot com
2011-09-28 20:40 ` paolo.carlini at oracle dot com
2011-11-03  1:19 ` paolo.carlini at oracle dot com
2011-11-04 16:32 ` paolo at gcc dot gnu.org
2011-11-04 16:36 ` paolo.carlini at oracle dot com
2011-12-13 20:05 ` redi at gcc dot gnu.org
2012-05-03  1:35 ` 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).