public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13867] New: constant variable of value zero not converted to (null) pointer
@ 2004-01-26 16:55 llewins at raytheon dot com
2004-01-26 17:48 ` [Bug c++/13867] " bangerth at dealii dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: llewins at raytheon dot com @ 2004-01-26 16:55 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/13867] constant variable of value zero not converted to (null) pointer
2004-01-26 16:55 [Bug c++/13867] New: constant variable of value zero not converted to (null) pointer llewins at raytheon dot com
@ 2004-01-26 17:48 ` 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
2 siblings, 0 replies; 4+ messages in thread
From: bangerth at dealii dot org @ 2004-01-26 17:48 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-01-26 17:48 -------
This is a duplicate of some error, but I don't have the time to figure out
which one right now.
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13867
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/13867] constant variable of value zero not converted to (null) pointer
2004-01-26 16:55 [Bug c++/13867] New: constant variable of value zero not converted to (null) pointer llewins at raytheon dot com
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
2 siblings, 0 replies; 4+ messages in thread
From: bangerth at dealii dot org @ 2004-01-26 18:03 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-01-26 18:03 -------
It is a duplicate of PR 396. In short, your code is invalid.
W.
*** This bug has been marked as a duplicate of 396 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13867
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/13867] constant variable of value zero not converted to (null) pointer
2004-01-26 16:55 [Bug c++/13867] New: constant variable of value zero not converted to (null) pointer llewins at raytheon dot com
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
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-04 19:35 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-06-04 19:35 -------
(In reply to comment #7)
> FWIW, WG21 thinks this is a bug:
> http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_closed.html#456
And is fixed in 4.0.0 and above already.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13867
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-06-04 19:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-26 16:55 [Bug c++/13867] New: constant variable of value zero not converted to (null) pointer llewins at raytheon dot com
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
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).