* Go patch committed: Permit calling new with a function type
@ 2011-05-11 23:06 Ian Lance Taylor
0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2011-05-11 23:06 UTC (permalink / raw)
To: gcc-patches, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 296 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 678 bytes --]
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-05-11 19:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-11 23:06 Go patch committed: Permit calling new with a function type Ian Lance Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).