From e45f44f3cf34d67b97e6a4240a912109d4a7038c Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 28 Mar 2011 21:35:46 +0000 Subject: [PATCH] Do not permit method expressions with pointers to interface types. From-SVN: r171633 --- gcc/go/gofrontend/expressions.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 78ae4fa13c0..d1de2037b9e 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -10263,7 +10263,7 @@ Selector_expression::lower_method_expression(Gogo* gogo) 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 @@ Selector_expression::lower_method_expression(Gogo* gogo) 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); } -- 2.30.2