From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3424 invoked by alias); 13 Jan 2015 20:42:13 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 3406 invoked by uid 89); 13 Jan 2015 20:42:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.7 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 13 Jan 2015 20:42:11 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0DKg9Dg005837 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 13 Jan 2015 15:42:10 -0500 Received: from [10.10.116.16] ([10.10.116.16]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t0DKg9Aw031820 for ; Tue, 13 Jan 2015 15:42:09 -0500 Message-ID: <54B5831D.3030801@redhat.com> Date: Tue, 13 Jan 2015 20:43:00 -0000 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/64520 (ICE with std::initializer_list) Content-Type: multipart/mixed; boundary="------------050803030902050607030205" X-SW-Source: 2015-01/txt/msg00933.txt.bz2 This is a multi-part message in MIME format. --------------050803030902050607030205 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 162 The special rules for deduction of std::initializer_list don't support a pack expansion, but we shouldn't crash. Tested x86_64-pc-linux-gnu, applying to trunk. --------------050803030902050607030205 Content-Type: text/x-patch; name="64520.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="64520.patch" Content-length: 1308 commit a1607c38aaf6e04c2a601ee78dca67984e179986 Author: Jason Merrill Date: Mon Jan 12 13:27:20 2015 -0500 PR c++/64520 * pt.c (unify): Don't try to deduce to std::initializer_list. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index d8652fb..3ac93db 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -17854,7 +17854,13 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict, if (TREE_CODE (parm) == ARRAY_TYPE) elttype = TREE_TYPE (parm); else - elttype = TREE_VEC_ELT (CLASSTYPE_TI_ARGS (parm), 0); + { + elttype = TREE_VEC_ELT (CLASSTYPE_TI_ARGS (parm), 0); + /* Deduction is defined in terms of a single type, so just punt + on the (bizarre) std::initializer_list. */ + if (PACK_EXPANSION_P (elttype)) + return unify_success (explain_p); + } FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (arg), i, elt) { diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist91.C b/gcc/testsuite/g++.dg/cpp0x/initlist91.C new file mode 100644 index 0000000..1387557 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist91.C @@ -0,0 +1,8 @@ +// PR c++/64520 +// { dg-do compile { target c++11 } } + +#include +struct A { + template A(std::initializer_list); +}; +A a { 0 }; // { dg-error "" } --------------050803030902050607030205--