From patchwork Thu Mar 29 14:13:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 149396 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 DCA98B6ED0 for ; Fri, 30 Mar 2012 01:13:50 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1333635231; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=oGh9N8u T2eJAd5+YIW6yAeK3Ubg=; b=f3iy/dvs5nT7k7faRKg0P9GBT7UUqdtTu5hxR9X JOGfmqdtbTYENDEp8NF0r3itzoISDAyCP/hgMFJAKFtR+tTsn9mfG1UgSEm6hECc lXe3wiB9bi0qjLWH8tkoc5BwTQ9qJKh1mflNXuxVjevZS1HwkZkUbG1GXH/Tf/RD zQbw= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=WZFPoDVBJYnRlTvMLlGCb4VG8m86CZy3wkaODgEw8cCRMNBOsE1jOKvNlaBPsI o8RqNHeDgVLOHT+7wvzSQl0Rg/aIuC1ejqoFJTJhbPZuPYZv5czS9EHRbXLgY5v+ 9tRb2AohfE79BmrWkXz+BymSQLfh7j7LsNgyW65UVMfcc=; Received: (qmail 14519 invoked by alias); 29 Mar 2012 14:13:45 -0000 Received: (qmail 14510 invoked by uid 22791); 29 Mar 2012 14:13:44 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 29 Mar 2012 14:13:31 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2TEDVg8031354 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 29 Mar 2012 10:13:31 -0400 Received: from [10.3.113.47] (ovpn-113-47.phx2.redhat.com [10.3.113.47]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q2TEDUj3024448 for ; Thu, 29 Mar 2012 10:13:31 -0400 Message-ID: <4F746E0A.2000404@redhat.com> Date: Thu, 29 Mar 2012 10:13:30 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/52743 (ICE with list-initialized array) 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 List-initialization of an array of scalars is not considered a user-defined conversion, so we need to check for it specifically to avoid treating it as a standard conversion. Tested x86_64-pc-linux-gnu, applying to trunk and 4.7. commit efaacb4065cce51b7374c31ddfb4682a880cbfc5 Author: Jason Merrill Date: Thu Mar 29 09:41:23 2012 -0400 PR c++/52743 * call.c (compare_ics): Handle ck_aggr like ck_list. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 88733f5..3c3dabb 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -7620,7 +7620,7 @@ compare_ics (conversion *ics1, conversion *ics2) Specifically, we need to do the reference binding comparison at the end of this function. */ - if (ics1->user_conv_p || ics1->kind == ck_list) + if (ics1->user_conv_p || ics1->kind == ck_list || ics1->kind == ck_aggr) { conversion *t1; conversion *t2; diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-array3.C b/gcc/testsuite/g++.dg/cpp0x/initlist-array3.C new file mode 100644 index 0000000..1a94f4e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist-array3.C @@ -0,0 +1,10 @@ +// PR c++/52743 +// { dg-do compile { target c++11 } } + +void composite (int const (&) [2]); +void composite (int const (&) [3]); + +int main () +{ + composite({0,1}); // { dg-error "ambiguous" } +}