This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: egcs 1.1.1 does not allow bool values as null pointer constants
- To: ark at research dot att dot com, egcs-bugs at cygnus dot com, egcs-patches at cygnus dot com
- Subject: Re: egcs 1.1.1 does not allow bool values as null pointer constants
- From: mrs at wrs dot com (Mike Stump)
- Date: Thu, 18 Feb 1999 14:11:21 -0800
> Date: Thu, 18 Feb 1999 14:56:47 -0500 (EST)
> From: Andrew Koenig <ark@research.att.com>
> Here's a program:
> void x()
> {
> int* p = 1==0;
> }
> I would expect this to compile, but egcs complains that it can't
> convert `bool' to a pointer type.
Long time no see... Hope things are going well with you... Thanks
for the bug report, bool _is_ an integer type. :-)
1999-02-18 Mike Stump <mrs@wrs.com>
* typeck.c (convert_for_assignment): Allow boolean integral constant
expressions to convert to null pointer.
Doing diffs in cp/typeck.c.~1~:
*** cp/typeck.c.~1~ Tue Jan 26 11:54:55 1999
--- cp/typeck.c Thu Feb 18 14:01:13 1999
*************** convert_for_assignment (type, rhs, errty
*** 6797,6803 ****
}
return cp_convert (type, rhs);
}
! else if (codel == POINTER_TYPE && coder == INTEGER_TYPE)
{
/* An explicit constant 0 can convert to a pointer,
but not a 0 that results from casting or folding. */
--- 6797,6805 ----
}
return cp_convert (type, rhs);
}
! else if (codel == POINTER_TYPE
! && (coder == INTEGER_TYPE
! || coder == BOOLEAN_TYPE))
{
/* An explicit constant 0 can convert to a pointer,
but not a 0 that results from casting or folding. */
--------------