From patchwork Mon Apr 1 21:17:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 232810 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 325AC2C012A for ; Tue, 2 Apr 2013 08:17:31 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=dIPp8qmp61D92gvDGWEIxebUV0pzaZoWUpDASFGsNzgK34 s2euXFyFBq4vmhdYyuqi91o4KAki1PXbowK8ALHRU4rAS3PSEGegjrPyFhAkyNYZ Kf5zwnuhvjWa2lVBgOulyoObh1AycsEoDVRvREEpcWwzl+DG2tvteMy07j6RM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=eNwLaC6loWa6HnfFtMDLUA1HT6M=; b=feAbejwSWf5zbHacCtcz DTixKbYK54k+63OqhcS5iGd9/6lcdH9ARiaTGlOhgjehEyPTZFYEskzcedpcbRF7 HTa2Ug3PXfuCQS22tCeVtYiu6bM2jG+E8SMiuYvVHOuHPGN1DjKMYJTp0IxKN4UB t/4toU1o+PsfbzIBdiQg4qw= Received: (qmail 12472 invoked by alias); 1 Apr 2013 21:17:19 -0000 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 Received: (qmail 12436 invoked by uid 89); 1 Apr 2013 21:17:13 -0000 X-Spam-SWARE-Status: No, score=-7.6 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 01 Apr 2013 21:17:10 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r31LH9Vj022892 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 1 Apr 2013 17:17:09 -0400 Received: from [10.3.113.94] (ovpn-113-94.phx2.redhat.com [10.3.113.94]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r31LH8a1028026 for ; Mon, 1 Apr 2013 17:17:08 -0400 Message-ID: <5159F953.9030603@redhat.com> Date: Mon, 01 Apr 2013 17:17:07 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Thunderbird/21.0a2 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/56772 (array new with initializer-list) X-Virus-Found: No Here trying to process the initializer at template time didn't work; let's not bother in this case. Tested x86_64-pc-linux-gnu, applying to trunk and 4.8. commit 48ec5c5cc4c8f5640dd25b3b455141cde868361c Author: Jason Merrill Date: Mon Apr 1 16:30:48 2013 -0400 PR c++/56772 * init.c (build_new): Don't try to process an array initializer at template definition time. diff --git a/gcc/cp/init.c b/gcc/cp/init.c index ab6af14..7b7de02 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -2920,6 +2920,7 @@ build_new (vec **placement, tree type, tree nelts, if (dependent_type_p (type) || any_type_dependent_arguments_p (*placement) || (nelts && type_dependent_expression_p (nelts)) + || (nelts && *init) || any_type_dependent_arguments_p (*init)) return build_raw_new_expr (*placement, type, nelts, *init, use_global_new); diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist68.C b/gcc/testsuite/g++.dg/cpp0x/initlist68.C new file mode 100644 index 0000000..7cfe1a3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist68.C @@ -0,0 +1,20 @@ +// PR c++/56772 +// { dg-require-effective-target c++11 } + +typedef __SIZE_TYPE__ size_t; +void* operator new[](size_t, void *p) { return p; } +template +void f () +{ + size_t coord [2][2]; + new (&coord) size_t [2][2] + { + {0,0}, + {0,0}, + }; +} + +int main () +{ + f<>(); +}