commit 66915c0956d505bf60140ff48021c0725edfa02c parent e06b6e3d1bf6342fdcd2481868d1d93cbb9a5028 Author: Roberto E. Vargas Caballero <k0ga@shike2.com> Date: Thu, 13 Aug 2015 09:43:58 +0200 Fix install() Install() failed when we wanted install a symbol in a different namespace where it was looked, and it was not declared. Diffstat:
M | cc1/symbol.c | | | 15 | ++++++++++----- |
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/cc1/symbol.c b/cc1/symbol.c @@ -247,13 +247,18 @@ Symbol * install(unsigned ns, Symbol *sym) { if (sym->ctx == curctx) { - if (sym->flags & ISDECLARED) - return NULL; - sym->flags |= ISDECLARED; - } else { - sym = linkhash(newsym(ns), sym->name); + if (sym->flags & ISDECLARED) { + if (ns == sym->ns) + return NULL; + } else { + sym->flags |= ISDECLARED; + sym->ns = ns; + goto assign_id; + } } + sym = linkhash(newsym(ns), sym->name); +assign_id: if (sym->ns != NS_CPP) sym->id = (curctx) ? ++localcnt : ++globalcnt;