diff mbox

Go patch committed: Fix bug when struct inherits varargs

Message ID mcrd38otmyy.fsf@dhcp-172-18-216-180.mtv.corp.google.com
State New
Headers show

Commit Message

Ian Lance Taylor March 7, 2012, 4:06 p.m. UTC
This patch to the Go compiler fixes a bug when a struct inherits from an
interface with a varargs method.  I added a test for this to the master
Go testsuite, which will be copied into gcc in due course.  Bootstrapped
and ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to
mainline.

Ian
diff mbox

Patch

diff -r e9c1caae3b22 go/types.cc
--- a/go/types.cc	Tue Mar 06 17:06:46 2012 -0800
+++ b/go/types.cc	Wed Mar 07 08:03:33 2012 -0800
@@ -3744,8 +3744,12 @@ 
   go_assert(!this->is_method());
   Typed_identifier* receiver = new Typed_identifier("", receiver_type,
 						    this->location_);
-  return Type::make_function_type(receiver, this->parameters_,
-				  this->results_, this->location_);
+  Function_type* ret = Type::make_function_type(receiver, this->parameters_,
+						this->results_,
+						this->location_);
+  if (this->is_varargs_)
+    ret->set_is_varargs();
+  return ret;
 }
 
 // Make a function type.