From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13785 invoked by alias); 25 Jul 2007 09:40:55 -0000 Received: (qmail 13777 invoked by uid 22791); 25 Jul 2007 09:40:54 -0000 X-Spam-Check-By: sourceware.org Received: from mail.suse.de (HELO mx1.suse.de) (195.135.220.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 25 Jul 2007 09:40:52 +0000 Received: from Relay2.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 7E71C122EE; Wed, 25 Jul 2007 11:40:50 +0200 (CEST) Message-ID: <46A71AD2.8090404@suse.de> Date: Wed, 25 Jul 2007 11:15:00 -0000 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050920 MIME-Version: 1.0 To: Mark Mitchell Cc: gcc-patches@gcc.gnu.org Subject: Re: [C++ Patch] PR 32108 References: <46960B4C.6070407@suse.de> <469C45D2.8060508@codesourcery.com> In-Reply-To: <469C45D2.8060508@codesourcery.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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 X-SW-Source: 2007-07/txt/msg01807.txt.bz2 Hi Mark, and sorry about the delay, still a bit jet-lagged, >Paolo Carlini wrote: > >>the issue here seems indeed rather simple. I'm only slightly nervous >>about the semantics of 'at_function_scope_p' exactly matching the >>documentation, which talks about "GCC allows you to declare local labels >>in any nested block scope". Otherwise, with the minimal patch the >>testcase is rejected consistently with the C front-end and issuing a >>consistent error message. >> >> >What does it say, exactly? > It says: "error: expected unqualified-id before '__label__'". For comparison, the C front-end says "error: expected identifier or '(' before '__label__'". > I think it would be better to call >cp_parser_label_declaration (just as we do now), but have >finish_label_decl issue an error message. Then, you can say "__label__ >declarations are only allowed in function scopes". > > Yes, I see what you mean, at some point I was figuring out a specific error message. Then, frankly, noticed that the C front-end was rejecting it with a similar error and decided to post the simple patch. >The tricky case here will be my least-favorite GNU extension: statement >expressions. Consider: > > void f(int i = ({ __label__ f; ... })) > >This should probably be allowed. But, I bet that in_function_scope_p >will return false when parsing the statement expression. You will have >to try it and see... > > What happens (I'm not expert of such extensions, admittedly), is that the contruct is already rejected without my patchlet: "error: statement-expressions are allowed only inside functions"... Please let me know if you want me to try something more... Thanks, Paolo.