From owner-sc22wg14+sc22wg14-domo2=www.open-std.org@open-std.org  Sat Sep 23 01:12:52 2017
Return-Path: <owner-sc22wg14+sc22wg14-domo2=www.open-std.org@open-std.org>
X-Original-To: sc22wg14-domo2
Delivered-To: sc22wg14-domo2@www.open-std.org
Received: by www.open-std.org (Postfix, from userid 521)
	id 9D189358A14; Sat, 23 Sep 2017 01:12:52 +0200 (CEST)
Delivered-To: sc22wg14@open-std.org
Received: from cirrus.dmk.com (cirrus.dmk.com [98.129.238.129])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by www.open-std.org (Postfix) with ESMTP id 2C1EB3569F7
	for <sc22wg14@open-std.org>; Sat, 23 Sep 2017 01:12:48 +0200 (CEST)
Received: from loess.dmk.com ([23.81.209.168])
	(authenticated bits=0)
	by cirrus.dmk.com (8.13.8/8.13.8) with ESMTP id v8MNCQUY013092
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Fri, 22 Sep 2017 16:12:45 -0700
	(envelope-from dmk@dmk.com)
Subject: Re: (SC22WG14.14797) Type qualifiers in [*] in abstract declarators
To: Joseph Myers <joseph@codesourcery.com>, sc22wg14@open-std.org
References: <20170922222716.E2E5C3586FD@www.open-std.org>
From: David Keaton <dmk@dmk.com>
Message-ID: <5102f42d-42e4-5c7c-a147-fa9e5d39c6c9@dmk.com>
Date: Fri, 22 Sep 2017 16:12:26 -0700
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
 Gecko/20100101 Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <20170922222716.E2E5C3586FD@www.open-std.org>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Sender: owner-sc22wg14@open-std.org
Precedence: bulk

Joseph,

      This was not deliberate.  I was planning on bringing this up for 
C2x, but if you'd like to take the lead on the issue, that would be great.

      New defect reports won't get attention for some time, so this 
would be best as a C2x proposal.

					David

On 2017-09-22 15:15, Joseph Myers wrote:
> An array declarator can have the form
> 
> direct-declarator [ type-qualifier-list_opt * ]
> 
> but the corresponding abstract-declarator syntax omits the
> type-qualifier-list_opt.  Is this deliberate, or a defect?  DR#289
> (C99TC3) fixed such a difference in the case where an assignment
> expression is involved, but did nothing about the [*] case.
> 
> If abstract declarators have a more restrictive syntax than declarators,
> this gives rise to perverse consequences of 6.7.6.3#11 "If, in a parameter
> declaration, an identifier can be treated either as a typedef name or as a
> parameter name, it shall be taken as a typedef name.".  Because if you
> have
> 
> typedef int T;
> void f(int (T[*]));
> 
> then that disambiguating rule means that f has an unnamed parameter of
> (pointer to) function type, where that function has a parameter of type
> T[*], rather than T being redeclared as a parameter.  But change that to
> 
> typedef int T;
> void f(int (T[const *]));
> 
> and T can no longer be interpreted as a typedef name, implying it's the
> name of the array (converted to pointer) parameter to function f.
> 

