Patchwork Go patch committed: Permit calling new with a function type

login
register
mail settings
Submitter Ian Taylor
Date May 11, 2011, 7:56 p.m.
Message ID <mcrhb91dn9i.fsf@coign.corp.google.com>
Download mbox | patch
Permalink /patch/95239/
State New
Headers show

Comments

Ian Taylor - May 11, 2011, 7:56 p.m.
The Go frontend incorrectly rejects calling new with a function type.
That was a holdover from a long time ago, before function types were
essentially pointers.  This patch removes the unnecessary check.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

Patch

diff -r 2c65483561e2 go/expressions.cc
--- a/go/expressions.cc	Wed May 11 12:37:53 2011 -0700
+++ b/go/expressions.cc	Wed May 11 12:46:50 2011 -0700
@@ -10624,9 +10624,6 @@ 
   do_determine_type(const Type_context*)
   { }
 
-  void
-  do_check_types(Gogo*);
-
   Expression*
   do_copy()
   { return new Allocation_expression(this->type_, this->location()); }
@@ -10639,15 +10636,6 @@ 
   Type* type_;
 };
 
-// Check the type of an allocation expression.
-
-void
-Allocation_expression::do_check_types(Gogo*)
-{
-  if (this->type_->function_type() != NULL)
-    this->report_error(_("invalid new of function type"));
-}
-
 // Return a tree for an allocation expression.
 
 tree