From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 103874 invoked by alias); 21 Aug 2015 17:11:40 -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 103859 invoked by uid 89); 21 Aug 2015 17:11:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: userp1040.oracle.com Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 21 Aug 2015 17:11:39 +0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t7LHBaKP019558 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 21 Aug 2015 17:11:37 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.13.8/8.13.8) with ESMTP id t7LHBaru003759 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 21 Aug 2015 17:11:36 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id t7LHBZrJ007583; Fri, 21 Aug 2015 17:11:35 GMT Received: from [192.168.1.4] (/79.37.218.190) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 21 Aug 2015 10:11:34 -0700 Subject: Re: [C++ Patch] PR 67065 ("Missing diagnostics for ill-formed program with main variable instead of function") To: Jason Merrill , Markus Trippelsdorf References: <55D4DD2D.3070500@oracle.com> <20150821061830.GB399@x4> <20150821063050.GC399@x4> <55D6E691.1000308@oracle.com> <55D6EA2C.2090400@oracle.com> <55D745AB.2070000@redhat.com> Cc: "gcc-patches@gcc.gnu.org" From: Paolo Carlini Message-ID: <55D75BC4.6070404@oracle.com> Date: Fri, 21 Aug 2015 17:22:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <55D745AB.2070000@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-08/txt/msg01336.txt.bz2 Hi, On 08/21/2015 05:37 PM, Jason Merrill wrote: > On 08/21/2015 05:06 AM, Paolo Carlini wrote: >> if (DECL_NAME (decl) >> && MAIN_NAME_P (DECL_NAME (decl)) >> - && CP_DECL_CONTEXT (decl) == global_namespace) >> + && CP_DECL_CONTEXT (decl) == global_namespace >> + && !at_function_scope_p ()) > > How about looking at the "scope" local variable instead of > CP_DECL_CONTEXT? Ah nice. Simply checking: scope == global_namespace appears to work great. Shall I go with that if testing is fine? Thanks! Paolo.