This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ Patch] PR 67065 ("Missing diagnostics for ill-formed program with main variable instead of function")


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]