From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 83231 invoked by alias); 15 Jan 2019 16:00:55 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 82924 invoked by uid 89); 15 Jan 2019 16:00:33 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2069, delayed X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 15 Jan 2019 16:00:31 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C3F9F356D4; Tue, 15 Jan 2019 16:00:24 +0000 (UTC) Received: from redhat.com (ovpn-120-189.rdu2.redhat.com [10.10.120.189]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D40645C7A0; Tue, 15 Jan 2019 16:00:20 +0000 (UTC) Date: Tue, 15 Jan 2019 16:00:00 -0000 From: Marek Polacek To: Jason Merrill Cc: Tom Honermann , Martin Sebor , gcc-patches , "Joseph S. Myers" Subject: Re: PATCH: Updated error messages for ill-formed cases of array initialization by string literal Message-ID: <20190115160025.GG19569@redhat.com> References: <50dbd993-f778-a2a4-e63c-1c2b3b85de41@gmail.com> <21994e14-d1b8-e893-72d2-86b9674e0fab@honermann.net> <99ca7332-f658-d5fe-fc42-b4199111ad3d@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <99ca7332-f658-d5fe-fc42-b4199111ad3d@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-SW-Source: 2019-01/txt/msg00852.txt.bz2 On Tue, Jan 15, 2019 at 10:15:22AM -0500, Jason Merrill wrote: > On 1/14/19 11:09 PM, Tom Honermann wrote: > > On 1/4/19 7:25 PM, Martin Sebor wrote: > > > On 12/27/18 1:49 PM, Tom Honermann wrote: > > > > As requested by Jason in the review of the P0482 (char8_t) core > > > > language changes, this patch includes updates to the error > > > > messages emitted for ill-formed cases of array initialization > > > > with a string literal.  With these changes, error messages that > > > > previously looked something like these: > > > > > > > > - "char-array initialized from wide string" > > > > - "wide character array initialized from non-wide string" > > > > - "wide character array initialized from incompatible wide string" > > > > > > > > now look like: > > > > > > > > - "cannot initialize array of type 'char' from a string literal > > > > with type array of 'short unsigned int'" > > > > > > The first word "type" doesn't quite work here.  The type of every > > > array is "array of T" where T is the type of the element, so for > > > instance, "array of char."  Saying "array of type X" makes it sound > > > like X is the type of the whole array, which is of course not > > > the case when X is char.  I think you want to use the same wording > > > as for the second type: > > > > > >   "cannot initialize array of 'char' from a string literal with > > >   type array of 'short unsigned int'" > > > > > > or perhaps even better > > > > > >   "cannot initialize array of 'char' from a string literal with > > >   type 'char16_t[N]'" > > > > > > (i.e., show the actual type of the string, including its bound). > > > > Thank you for the feedback, Martin; sorry for the delayed response. I'll > > follow up with a revised patch within the next week or two. > > I actually incorporated the C++ part of these changes into yesterday's > commit, using Martin's first suggestion. Here's the adjusted C patch, which > I'd like a C maintainer to approve. Patch is OK, thanks. Marek