From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 56697 invoked by alias); 28 Jan 2016 23:33:15 -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 56682 invoked by uid 89); 28 Jan 2016 23:33:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=gc 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 28 Jan 2016 23:33:13 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 93C61C0A849F; Thu, 28 Jan 2016 23:33:12 +0000 (UTC) Received: from redhat.com (ovpn-204-33.brq.redhat.com [10.40.204.33]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0SNX9aw012555 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 28 Jan 2016 18:33:11 -0500 Date: Thu, 28 Jan 2016 23:33:00 -0000 From: Marek Polacek To: Prathamesh Kulkarni Cc: gcc Patches Subject: Re: [C++ patch] report better diagnostic for static following '[' in parameter declaration Message-ID: <20160128233308.GI25193@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-SW-Source: 2016-01/txt/msg02267.txt.bz2 On Fri, Jan 29, 2016 at 04:46:56AM +0530, Prathamesh Kulkarni wrote: > @@ -19016,10 +19017,22 @@ cp_parser_direct_declarator (cp_parser* parser, > cp_lexer_consume_token (parser->lexer); > /* Peek at the next token. */ > token = cp_lexer_peek_token (parser->lexer); > + > + /* If static keyword immediately follows [, report error. */ > + if (cp_lexer_next_token_is_keyword (parser->lexer, RID_STATIC) > + && current_binding_level->kind == sk_function_parms) > + { > + error_at (token->location, > + "static array size is a C99 feature," > + "not permitted in C++"); > + bounds = error_mark_node; > + } > + I think this isn't sufficient as-is; if we're changing the diagnostics here, we should also handle e.g. void f(int a[const 10]); where clang++ says g.C:1:13: error: qualifier in array size is a C99 feature, not permitted in C++ And also e.g. void f(int a[const static 10]); void f(int a[static const 10]); and similar. Marek