In the patch I just committed, I overlooked that a pointer to a named interface type has no methods, and therefore that you can not use such a type with a method expression. This patch corrects that oversight. To make the error more clear, I added a '*' to the error output for a pointer type. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
diff -r e1908705ee52 go/expressions.cc --- a/go/expressions.cc Mon Mar 28 14:21:14 2011 -0700 +++ b/go/expressions.cc Mon Mar 28 14:31:26 2011 -0700 @@ -10263,7 +10263,7 @@ bool is_ambiguous; Method* method = nt->method_function(name, &is_ambiguous); const Typed_identifier* imethod = NULL; - if (method == NULL) + if (method == NULL && !is_pointer) { Interface_type* it = nt->interface_type(); if (it != NULL) @@ -10273,12 +10273,14 @@ if (method == NULL && imethod == NULL) { if (!is_ambiguous) - error_at(location, "type %<%s%> has no method %<%s%>", + error_at(location, "type %<%s%s%> has no method %<%s%>", + is_pointer ? "*" : "", nt->message_name().c_str(), Gogo::message_name(name).c_str()); else - error_at(location, "method %<%s%> is ambiguous in type %<%s%>", + error_at(location, "method %<%s%s%> is ambiguous in type %<%s%>", Gogo::message_name(name).c_str(), + is_pointer ? "*" : "", nt->message_name().c_str()); return Expression::make_error(location); }