Commit cf6a9610 by Paolo Carlini Committed by Paolo Carlini

decl.c (grokvardecl): Complete check added for c++/67065.

/cp
2015-08-21  Paolo Carlini  <paolo.carlini@oracle.com>

	* decl.c (grokvardecl): Complete check added for c++/67065.

/testsuite
2015-08-21  Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/other/pr67065.C: Extend.

From-SVN: r227061
parent 3b14abc8
2015-08-21 Paolo Carlini <paolo.carlini@oracle.com>
* decl.c (grokvardecl): Complete check added for c++/67065.
2015-08-20 Jason Merrill <jason@redhat.com>
* name-lookup.c (hidden_name_p): Handle OVERLOAD.
......
......@@ -8357,7 +8357,8 @@ grokvardecl (tree type,
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 ())
error ("cannot declare %<::main%> to be a global variable");
/* Check that the variable can be safely declared as a concept.
......
2015-08-21 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/other/pr67065.C: Extend.
2015-08-21 Nathan Sidwell <nathan@acm.org>
* lib/target-supports.exp (check_effective_target_freestanding): nvptx
......
// PR c++/67065
int main; // { dg-error "cannot declare" }
void foo() { int main; }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment