From patchwork Wed May 11 19:56:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 95239 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id BBBF6B6F6C for ; Thu, 12 May 2011 13:03:44 +1000 (EST) Received: (qmail 5930 invoked by alias); 11 May 2011 19:57:01 -0000 Received: (qmail 5919 invoked by uid 22791); 11 May 2011 19:57:01 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 May 2011 19:56:46 +0000 Received: from kpbe18.cbf.corp.google.com (kpbe18.cbf.corp.google.com [172.25.105.82]) by smtp-out.google.com with ESMTP id p4BJuiWq022190 for ; Wed, 11 May 2011 12:56:45 -0700 Received: from pzk6 (pzk6.prod.google.com [10.243.19.134]) by kpbe18.cbf.corp.google.com with ESMTP id p4BJuX7h030333 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Wed, 11 May 2011 12:56:43 -0700 Received: by pzk6 with SMTP id 6so448260pzk.26 for ; Wed, 11 May 2011 12:56:43 -0700 (PDT) Received: by 10.68.51.67 with SMTP id i3mr11924683pbo.51.1305143803230; Wed, 11 May 2011 12:56:43 -0700 (PDT) Received: from coign.google.com (dhcp-172-22-126-184.mtv.corp.google.com [172.22.126.184]) by mx.google.com with ESMTPS id d9sm173214pba.16.2011.05.11.12.56.42 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 11 May 2011 12:56:42 -0700 (PDT) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: Go patch committed: Permit calling new with a function type Date: Wed, 11 May 2011 12:56:41 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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