aboutsummaryrefslogtreecommitdiff
path: root/src/compiler/decl.zc
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/decl.zc')
-rw-r--r--src/compiler/decl.zc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/compiler/decl.zc b/src/compiler/decl.zc
index 0870756..6794373 100644
--- a/src/compiler/decl.zc
+++ b/src/compiler/decl.zc
@@ -285,6 +285,10 @@ int fndef(int chk, int rty, int ret, int n) {
if (rty || ntp) typed = 1;
if (!dnm) dnm = n;
s = lookup(n);
+ if (s >= ubase && skind[s] == K_FN && (sflag[s] & F_DEF) && !(sflag[s] & F_TPL) && !ginst && !ntp) { // appendix b.2.3: the same name in the same module
+ word qn = n; if (module_name) qn = module_symbol(n);
+ if (rt.eq_w(sname[s], qn)) serrn(n, "is defined twice");
+ }
if (s < 0 || s < ubase || skind[s] != K_FN || (sflag[s] & F_DEF)) {
s = addsym(n, K_FN, 0);
sflag[s] = 0;