From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 61701 invoked by alias); 19 Aug 2015 20:27:03 -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 61692 invoked by uid 89); 19 Aug 2015 20:27:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: aserp1040.oracle.com Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 19 Aug 2015 20:27:02 +0000 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t7JKR0qn017577 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 19 Aug 2015 20:27:00 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id t7JKQxWW007179 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 19 Aug 2015 20:26:59 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id t7JKQx9A007791; Wed, 19 Aug 2015 20:26:59 GMT Received: from [192.168.1.4] (/79.37.218.190) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Aug 2015 13:26:59 -0700 Subject: Re: [C++ Patch] PR 67065 ("Missing diagnostics for ill-formed program with main variable instead of function") To: Ville Voutilainen , "gcc-patches@gcc.gnu.org" , Jason Merrill References: From: Paolo Carlini Message-ID: <55D4E690.7020703@oracle.com> Date: Wed, 19 Aug 2015 20:28: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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-08/txt/msg01136.txt.bz2 Hi Ville, On 08/19/2015 10:12 PM, Ville Voutilainen wrote: >> submitter noticed that, in violation of [basic.start.main], we don't reject >> as ill-formed the declaration of a 'main' variable in the global namespace. >> Not a big deal IMHO, but the below simple check works well for me on x86_64-linux. > Just fyi, gcc accepts > > decltype(main) x; > > decltype(sizeof(decltype(main)*)) x; > > which are "uses" of main and also violate [basic.start.main]/3. "good" to know. In my experience sometimes the front end appears to so-to-speak pre-declare entities. For instance I filed a while ago c++/48396. Not sure if in practice the exact same code is involved... Paolo.