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

From-SVN: r200426
This commit is contained in:
Ian Lance Taylor 2013-06-26 15:47:53 +00:00
parent 31f02c7752
commit cf5ef6bd80

View file

@ -1278,6 +1278,14 @@ Gogo::define_global_names()
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");
}
}
}