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

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

Reply via email to