diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2013-06-26 15:47:53 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2013-06-26 15:47:53 +0000 |
commit | cf5ef6bd807520fd71819c96959dbd999eaed5e7 (patch) | |
tree | b4bd2ed1c90af52e277c9290b7bc127033697854 /gcc/go | |
parent | 31f02c775233015db6fb95d31a9cff7a193428d8 (diff) | |
download | gcc-cf5ef6bd807520fd71819c96959dbd999eaed5e7.zip gcc-cf5ef6bd807520fd71819c96959dbd999eaed5e7.tar.gz gcc-cf5ef6bd807520fd71819c96959dbd999eaed5e7.tar.bz2 |
compiler: forbid identifiers named "init" in package scope.
From-SVN: r200426
Diffstat (limited to 'gcc/go')
-rw-r--r-- | gcc/go/gofrontend/gogo.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index 24f890c..a21493a 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"); + } } } |