From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 34316 invoked by alias); 5 Jan 2019 00:26:05 -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 34260 invoked by uid 89); 5 Jan 2019 00:26:04 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=HContent-Transfer-Encoding:8bit X-HELO: mail-qt1-f179.google.com Received: from mail-qt1-f179.google.com (HELO mail-qt1-f179.google.com) (209.85.160.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 05 Jan 2019 00:26:03 +0000 Received: by mail-qt1-f179.google.com with SMTP id v11so42233624qtc.2 for ; Fri, 04 Jan 2019 16:26:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Dm/escl9DcrHbGtR8wCLDS+sullilMAit9A4zETtnqI=; b=mkbpXVK7A+QI8RW2PrR9hcUx7RwdC6MSdvj30xeKRtXW3Htc9KKukC7+DP80F3pjJz qdvP9zQm184TgdTVvXvlWHtggjjYHgbtDXHMIHRtCiNJXWGyGMP+aKAO5ILNv31p6DQN cQS3sGgNhVy2+Z45bSzNsBWfRYEqhxQgwpsWoH7lQn9ThAqUTmXb5X62buT5CYK4dYgC 0F0Y1r7x7wTqpAuqzJQf06SA7J1gfh2N51fQkCR2d91r3s+5I6lOIbsallBzU2tpJPZW LFSsAy9CT/KtkzqyaHGKZIpicXQdMj/RTZBkK8YehNEBuHONjGH+GMHj11CkuAu/T40i di+g== Return-Path: Received: from [192.168.0.106] (174-16-101-177.hlrn.qwest.net. [174.16.101.177]) by smtp.gmail.com with ESMTPSA id o25sm32499948qtj.10.2019.01.04.16.25.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Jan 2019 16:26:00 -0800 (PST) Subject: Re: PATCH: Updated error messages for ill-formed cases of array initialization by string literal To: Tom Honermann , gcc-patches Cc: Jason Merrill References: From: Martin Sebor Message-ID: <50dbd993-f778-a2a4-e63c-1c2b3b85de41@gmail.com> Date: Sat, 05 Jan 2019 00:26:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-01/txt/msg00191.txt.bz2 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). Martin