diff options
| author | 2026-10-14 16:10:42 +0330 | |
|---|---|---|
| committer | 2026-10-14 16:10:42 +0330 | |
| commit | a752292b54e22a8024b9d9162762edd2efa533b5 (patch) | |
| tree | c19c48c792237538ae2a393d2af9e15fd2884c55 /src/compiler/decl.zc | |
| parent | unary: u*x, m*x, d*x are not recasts when the tag names a global variable either (diff) | |
fndef: a second definition of a function in the same module is 'is defined twice' (appendix b.2.3)
Diffstat (limited to 'src/compiler/decl.zc')
| -rw-r--r-- | src/compiler/decl.zc | 4 |
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; |
