From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21112 invoked by alias); 11 May 2007 07:06:05 -0000 Received: (qmail 21042 invoked by alias); 11 May 2007 07:05:53 -0000 Date: Fri, 11 May 2007 07:06:00 -0000 Message-ID: <20070511070553.21040.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c/31887] bad warning converting qualified void* to qualified array pointer In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "raeburn at raeburn dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-05/txt/msg00808.txt.bz2 ------- 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