This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/55096] New: Wconversion-nul does not work in C


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

             Bug #: 55096
           Summary: Wconversion-nul does not work in C
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: manu@gcc.gnu.org


From: http://blog.llvm.org/2011/05/c-at-google-here-be-dragons.html

#include <stdbool.h>
bool foo(void);
bool * ProcessRequest(bool *charge_acct) {
  if (foo()) {
    charge_acct = false;
  }
  return charge_acct;
}

gcc -Wall -Wconversion -Wextra: silence :-(

g++
test2.cc:5:17: warning: converting âfalseâ to pointer type âbool*â
[-Wconversion-null]
     charge_acct = false;
                 ^

clang/clang++

test2.cc:5:19: warning: initialization of pointer of type 'bool *' to null from
a constant boolean expression [-Wbool-conversion]
    charge_acct = false;
                  ^~~~~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]