public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paolo Carlini <paolo.carlini@oracle.com>
To: Jason Merrill <jason@redhat.com>,
	       Markus Trippelsdorf <markus@trippelsdorf.de>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [C++ Patch] PR 67065 ("Missing diagnostics for ill-formed program with main variable instead of function")
Date: Fri, 21 Aug 2015 17:22:00 -0000	[thread overview]
Message-ID: <55D75BC4.6070404@oracle.com> (raw)
In-Reply-To: <55D745AB.2070000@redhat.com>

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.

  reply	other threads:[~2015-08-21 17:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-19 19:52 Paolo Carlini
2015-08-20  2:35 ` Jason Merrill
2015-08-21  6:30 ` Markus Trippelsdorf
2015-08-21  7:47   ` Markus Trippelsdorf
2015-08-21  9:07     ` Paolo Carlini
2015-08-21  9:22       ` Paolo Carlini
2015-08-21  9:29         ` Markus Trippelsdorf
2015-08-21 12:57           ` Paolo Carlini
2015-08-21 15:44         ` Jason Merrill
2015-08-21 17:22           ` Paolo Carlini [this message]
2015-08-21 17:37             ` Jason Merrill
2015-08-19 20:27 Ville Voutilainen
2015-08-19 20:28 ` Paolo Carlini
2015-08-19 20:37   ` Ville Voutilainen
2015-08-19 20:42     ` Paolo Carlini
2015-08-19 21:46       ` Ville Voutilainen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55D75BC4.6070404@oracle.com \
    --to=paolo.carlini@oracle.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=markus@trippelsdorf.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).