Commit cf5ef6bd by Ian Lance Taylor

compiler: forbid identifiers named "init" in package scope.

From-SVN: r200426
parent 31f02c77
...@@ -1278,6 +1278,14 @@ Gogo::define_global_names() ...@@ -1278,6 +1278,14 @@ Gogo::define_global_names()
n.c_str()); n.c_str());
inform(pf->second, "%qs imported here", n.c_str()); inform(pf->second, "%qs imported here", n.c_str());
} }
// No package scope identifier may be named "init".
if (!p->second->is_function()
&& Gogo::unpack_hidden_name(p->second->name()) == "init")
{
error_at(p->second->location(),
"cannot declare init - must be func");
}
} }
} }
......
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