From: Ian Lance Taylor Date: Wed, 26 Jun 2013 15:47:53 +0000 (+0000) Subject: compiler: forbid identifiers named "init" in package scope. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cf5ef6bd807520fd71819c96959dbd999eaed5e7;p=gcc.git compiler: forbid identifiers named "init" in package scope. From-SVN: r200426 --- diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index 24f890cdef9..a21493a786c 100644 --- a/gcc/go/gofrontend/gogo.cc +++ b/gcc/go/gofrontend/gogo.cc @@ -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"); + } } }