[C++ Patch] PR 67065 ("Missing diagnostics for ill-formed program with main variable instead of function")
Paolo Carlini
paolo.carlini@oracle.com
Fri Aug 21 17:22:00 GMT 2015
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.
More information about the Gcc-patches
mailing list