public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "llewins at raytheon dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/13867] New: constant variable of value zero not converted to (null) pointer Date: Mon, 26 Jan 2004 16:55:00 -0000 [thread overview] Message-ID: <20040126165508.13867.llewins@raytheon.com> (raw) The following code should compile since null is a constant expression which evaluates to zero. FALSE is similarly a zero constant expression and also should compile. #include <iostream> using namespace std; void foo(int* p) { cout << "int*" << endl; } int main(void) { const int null = 0; foo(null); const bool FALSE = false; foo(FALSE); } Instead the following error message is generated: Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/specs Configured with: /GCC/gcc-3.3.1-3/configure --with-gcc --with-gnu-ld --with-gnu- as --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexe cdir=/usr/sbin --mandir=/usr/share/man --infodir=/usr/share/info --enable-langua ges=c,ada,c++,f77,pascal,java,objc --enable-libgcj --enable-threads=posix --with -system-zlib --enable-nls --without-included-gettext --enable-interpreter --enab le-sjlj-exceptions --disable-version-specific-runtime-libs --enable-shared --dis able-win32-registry --enable-java-gc=boehm --disable-hash-synchronization --verb ose --target=i686-pc-cygwin --host=i686-pc-cygwin --build=i686-pc-cygwin Thread model: posix gcc version 3.3.1 (cygming special) /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/cc1plus.exe -E -D__GNUG__=3 -quiet -v -D_ _GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=1 -D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -idirafter /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/../ ../../../include/w32api -idirafter /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/../../. ./../i686-pc-cygwin/lib/../../include/w32api bug.cc bug.ii ignoring nonexistent directory "/usr/local/include" ignoring nonexistent directory "/usr/i686-pc-cygwin/include" ignoring duplicate directory "/usr/i686-pc-cygwin/lib/../../include/w32api" #include "..." search starts here: #include <...> search starts here: /usr/include/c++/3.3.1 /usr/include/c++/3.3.1/i686-pc-cygwin /usr/include/c++/3.3.1/backward /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/include /usr/include /usr/include/w32api End of search list. /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/cc1plus.exe -fpreprocessed bug.ii -quiet -dumpbase bug.cc -auxbase bug -version -o bug.s GNU C++ version 3.3.1 (cygming special) (i686-pc-cygwin) compiled by GNU C version 3.3.1 (cygming special). GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=130998 bug.cc: In function `int main()': bug.cc:17: error: invalid conversion from `int' to `int*' bug.cc:19: error: cannot convert `const bool' to `int*' for argument `1' to ` void foo(int*)' -- Summary: constant variable of value zero not converted to (null) pointer Product: gcc Version: 3.3.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: llewins at raytheon dot com CC: gcc-bugs at gcc dot gnu dot org GCC host triplet: i686-pc-cygwin http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13867
next reply other threads:[~2004-01-26 16:55 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-01-26 16:55 llewins at raytheon dot com [this message] 2004-01-26 17:48 ` [Bug c++/13867] " bangerth at dealii dot org 2004-01-26 18:03 ` bangerth at dealii dot org 2005-06-04 19:35 ` pinskia at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20040126165508.13867.llewins@raytheon.com \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).