This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/31887] bad warning converting qualified void* to qualified array pointer
- From: "raeburn at raeburn dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 May 2007 07:05:53 -0000
- Subject: [Bug c/31887] bad warning converting qualified void* to qualified array pointer
- References: <bug-31887-11337@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from raeburn at raeburn dot org 2007-05-11 08:05 -------
Subject: Re: bad warning converting qualified void* to qualified array pointer
On May 10, 2007, at 19:00, pinskia at gcc dot gnu dot org wrote:
> I think only "void*" can be done with an implicat cast so we go
> from const
> void* to void* and then to const block*.
ISO/IEC 9899-1999 section 6.5.16.1 (assignment constraints) includes:
- one operand is a pointer to an object or incomplete type and the
other is a pointer to a qualified or unqualified version of void, and
the type pointed to by the left has all the qualifiers of the type
pointed to by the right.
So I'm pretty sure we don't automatically lose on the const-ness in
the general case. What I'm less sure about is how the array type
plays into it. According to 6.7.3, "const block" means "array [8] of
const unsigned char", so is there an argument to be made that
assigning a pointer-to-const value to an lvalue of type pointer to an
unqualified array type (containing a type that happens to be const-
qualified) isn't allowed? I don't think it would be logical, but
that doesn't guarantee that that's how the standard actually works.
Ken
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31887