This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14644] New: enum of value zero not converted to (null) pointer
- From: "llewins at raytheon dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Mar 2004 04:17:38 -0000
- Subject: [Bug c++/14644] New: enum of value zero not converted to (null) pointer
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code should compile since NULL is a constant expression which
evaluates to zero. NULL is also an rvalue -- so the questioned reasoning under
bug 13867 cannot be used.
# 1 "test2.cc"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "test2.cc"
enum {NULL = 0};
void f(int*);
int main()
{
f(NULL);
}
Instead the following error message is generated:
test2.cc: In function `int main()':
test2.cc:7: error: cannot convert `<anonymous enum>' to `int*' for argument `1'
to `void f(int*)'
Compiler used is:
~>g++ -v
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 --libexecdir=/usr/sbin --mandir=/usr/share/man --
infodir=/usr/share/info --enable-languages=c,ada,c++,f77,pa
scal,java,objc --enable-libgcj --enable-threads=posix --with-system-zlib --
enable-nls --without-included-gettext --enable-interpre
ter --enable-sjlj-exceptions --disable-version-specific-runtime-libs --enable-
shared --disable-win32-registry --enable-java-gc=boe
hm --disable-hash-synchronization --verbose --target=i686-pc-cygwin --
host=i686-pc-cygwin --build=i686-pc-cygwin
Thread model: posix
gcc version 3.3.1 (cygming special)
--
Summary: enum 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
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14644