projects
/
gcc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
31f02c7
)
compiler: forbid identifiers named "init" in package scope.
author
Ian Lance Taylor
<ian@gcc.gnu.org>
Wed, 26 Jun 2013 15:47:53 +0000
(15:47 +0000)
committer
Ian Lance Taylor
<ian@gcc.gnu.org>
Wed, 26 Jun 2013 15:47:53 +0000
(15:47 +0000)
From-SVN: r200426
gcc/go/gofrontend/gogo.cc
patch
|
blob
|
history
diff --git
a/gcc/go/gofrontend/gogo.cc
b/gcc/go/gofrontend/gogo.cc
index 24f890cdef98529c69c74d2d08d1a058fb75be04..a21493a786c6e7ccab45151eda81a8a8046ddb40 100644
(file)
--- 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");
+ }
}
}