This patch to the Go frontend fixes the case where a package is imported twice, by two different source files, and the second import uses _ as the local name. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
diff -r f3dfe292768b go/gogo.cc --- a/go/gogo.cc Mon Mar 07 13:19:55 2011 -0800 +++ b/go/gogo.cc Mon Mar 07 13:26:17 2011 -0800 @@ -308,12 +308,7 @@ ln = package->name(); is_ln_exported = Lex::is_exported_name(ln); } - if (ln != ".") - { - ln = this->pack_hidden_name(ln, is_ln_exported); - this->package_->bindings()->add_package(ln, package); - } - else + if (ln == ".") { Bindings* bindings = package->bindings(); for (Bindings::const_declarations_iterator p = @@ -322,6 +317,13 @@ ++p) this->add_named_object(p->second); } + else if (ln == "_") + package->set_uses_sink_alias(); + else + { + ln = this->pack_hidden_name(ln, is_ln_exported); + this->package_->bindings()->add_package(ln, package); + } return; }