From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3180 invoked by alias); 6 Jul 2010 19:22:15 -0000 Received: (qmail 3171 invoked by uid 22791); 6 Jul 2010 19:22:14 -0000 X-SWARE-Spam-Status: No, hits=-6.0 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; Tue, 06 Jul 2010 19:22:08 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o66JM72V021906 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 6 Jul 2010 15:22:07 -0400 Received: from [IPv6:::1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o66JM6fK030160 for ; Tue, 6 Jul 2010 15:22:06 -0400 Message-ID: <4C33825D.4080308@redhat.com> Date: Tue, 06 Jul 2010 19:22:00 -0000 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.10) Gecko/20100619 Lightning/1.0b1 Shredder/3.0.6pre MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/44703 (initializer_list typedef) Content-Type: multipart/mixed; boundary="------------080400080208050205060702" 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 X-SW-Source: 2010-07/txt/msg00469.txt.bz2 This is a multi-part message in MIME format. --------------080400080208050205060702 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 122 Need to look through typedefs if we're doing matching on names... Tested x86_64-pc-linux-gnu, applying to trunk and 4.5. --------------080400080208050205060702 Content-Type: text/x-patch; name="44703.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="44703.patch" Content-length: 1148 commit f7a5840c46397ad2e75b9f3a47219d697a75bccf Author: Jason Merrill Date: Sun Jul 4 09:57:42 2010 -0400 PR c++/44703 * call.c (is_std_init_list): Look through typedefs. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index c4f3e95..0bf7b8e 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -7953,6 +7953,10 @@ initialize_reference (tree type, tree expr, tree decl, tree *cleanup, bool is_std_init_list (tree type) { + /* Look through typedefs. */ + if (!TYPE_P (type)) + return false; + type = TYPE_MAIN_VARIANT (type); return (CLASS_TYPE_P (type) && CP_TYPE_CONTEXT (type) == std_node && strcmp (TYPE_NAME_STRING (type), "initializer_list") == 0); diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist41.C b/gcc/testsuite/g++.dg/cpp0x/initlist41.C new file mode 100644 index 0000000..b538548 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist41.C @@ -0,0 +1,14 @@ +// PR c++/44703 +// { dg-options -std=c++0x } + +#include + +typedef std::initializer_list type ; +void f(type) {} + +int main() +{ +// error: could not convert '{1, 2, 3}' to 'type' + f({1,2,3}) ; +} + --------------080400080208050205060702--