This patch to the Go frontend fixes a bug that can arise when a type in package A inherits from a type in package B, where the type in package B has a hidden method, and a third package C tries to convert the package A type to the B interface type. The compiler was failing to generate the required interface table, and the result was an undefined symbol at link time. This patch fixes the bug by arranging to build interface tables for imported interfaces as needed. I added a test case to the master testsuite, which will be copied over in due course. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline and 4.7 branch.
Ian
diff -r a54270dc09fa go/import.cc --- a/go/import.cc Thu May 03 09:07:09 2012 -0700 +++ b/go/import.cc Thu May 03 10:38:47 2012 -0700 @@ -669,6 +669,9 @@ // This type has not yet been imported. ntype->clear_is_visible(); + if (!type->is_undefined() && type->interface_type() != NULL) + this->gogo_->record_interface_type(type->interface_type()); + type = ntype; } else if (no->is_type())