From patchwork Tue Nov 1 04:02:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 123017 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 4B329B6F76 for ; Tue, 1 Nov 2011 15:02:42 +1100 (EST) Received: (qmail 8271 invoked by alias); 1 Nov 2011 04:02:39 -0000 Received: (qmail 8253 invoked by uid 22791); 1 Nov 2011 04:02:38 -0000 X-SWARE-Spam-Status: No, hits=-7.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, SPF_HELO_PASS, T_FRT_FRIEND 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, 01 Nov 2011 04:02:22 +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 pA142LR6014690 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 1 Nov 2011 00:02:21 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id pA142LSu011952 for ; Tue, 1 Nov 2011 00:02:21 -0400 Received: from [0.0.0.0] (ovpn-113-26.phx2.redhat.com [10.3.113.26]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id pA142JFB025491 for ; Tue, 1 Nov 2011 00:02:20 -0400 Message-ID: <4EAF6F4B.3090105@redhat.com> Date: Tue, 01 Nov 2011 00:02:19 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20111001 Thunderbird/7.0.1 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH to disable -fdeduce-init-list by default 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 In my implementation of the C++11 list-initialization proposal, I also implemented an extension that allowed for deduction of std::initializer_list<...> for a template type parameter, so that people could try it out and see what they thought. This extension didn't make it into C++11, so I'm switching its flag to be off by default. Tested x86_64-pc-linux-gnu, applying to trunk. commit 03e84320fcb7868a31016c7cb80596e38a5183d5 Author: Jason Merrill Date: Mon Oct 31 22:02:29 2011 -0400 * c.opt (-fdeduce-init-list): Off by default. diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 336a75a..6d50097 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -752,8 +752,8 @@ C ObjC C++ ObjC++ Emit debug annotations during preprocessing fdeduce-init-list -C++ ObjC++ Var(flag_deduce_init_list) Init(1) --fno-deduce-init-list disable deduction of std::initializer_list for a template type parameter from a brace-enclosed initializer-list +C++ ObjC++ Var(flag_deduce_init_list) Init(0) +-fdeduce-init-list enable deduction of std::initializer_list for a template type parameter from a brace-enclosed initializer-list fdefault-inline C++ ObjC++ Ignore diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 0c97453..2836b74 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1907,9 +1907,9 @@ to @var{n}. A limit is needed to detect endless recursion during constant expression evaluation. The minimum specified by the standard is 512. -@item -fno-deduce-init-list -@opindex fno-deduce-init-list -Disable deduction of a template type parameter as +@item -fdeduce-init-list +@opindex fdeduce-init-list +Enable deduction of a template type parameter as std::initializer_list from a brace-enclosed initializer list, i.e. @smallexample @@ -1924,9 +1924,10 @@ void f() @} @end smallexample -This option is present because this deduction is an extension to the -current specification in the C++0x working draft, and there was -some concern about potential overload resolution problems. +This deduction was implemented as a possible extension to the +originally proposed semantics for the C++11 standard, but was not part +of the final standard, so it is disabled by default. This option is +deprecated, and may be removed in a future version of G++. @item -ffriend-injection @opindex ffriend-injection diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-deduce.C b/gcc/testsuite/g++.dg/cpp0x/initlist-deduce.C index e422132..373044f 100644 --- a/gcc/testsuite/g++.dg/cpp0x/initlist-deduce.C +++ b/gcc/testsuite/g++.dg/cpp0x/initlist-deduce.C @@ -2,7 +2,7 @@ // supported by the working draft, but is necessary for perfect forwarding // of initializer-lists to things that can take a std::initializer_list. -// { dg-options -std=c++0x } +// { dg-options "-std=c++0x -fdeduce-init-list" } // { dg-do run } #include