From patchwork Tue Jul 31 00:14:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 174124 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 B17B82C0080 for ; Tue, 31 Jul 2012 10:15:18 +1000 (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=1344298519; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Message-ID:Date:From:User-Agent:MIME-Version: To:CC:Subject:References:In-Reply-To:Content-Type:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=xwMJUnHTZgvb7tB4syP08JLD/tE=; b=q0FrL0e1dsKatrOqVaiNFqG/DXj5exXxQI8Aw/qOQFlLbGByxQA6NJzeow5m7A T1tSgxVXVDt1/028ZQCD+Oberfs0/ckc9EWJ4VaAE8IdX2vAARwhPLU+2upCKVPf ImUBZ4vgZoX9miIm4wRXODpkl6EbJg2iT4cl1PiXBp2IE= 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:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=wv/THO6Tqo369w4uYBEtqApZ7FL8Odjc7fxYsyrjFC+79iEIcHqhQy2SUdim5R HO39FWSU9P1vnjNMiIAw6smmn/kt1nIoNaOdsz9IxgYtLOMQ07ntv1Vx4w3/qeFm LO6PvyYNR2Q1hQ1M2+LZZ4OmWuDKPzmqtfXes88ivV5m0=; Received: (qmail 22523 invoked by alias); 31 Jul 2012 00:15:09 -0000 Received: (qmail 22456 invoked by uid 22791); 31 Jul 2012 00:15:03 -0000 X-SWARE-Spam-Status: No, hits=-7.4 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_THREADED, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_YE, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rcsinet15.oracle.com (HELO rcsinet15.oracle.com) (148.87.113.117) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 31 Jul 2012 00:14:48 +0000 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q6V0Ek9i022269 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 31 Jul 2012 00:14:47 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q6V0Ej3F022137 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 31 Jul 2012 00:14:46 GMT Received: from abhmt117.oracle.com (abhmt117.oracle.com [141.146.116.69]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q6V0EjVL031298; Mon, 30 Jul 2012 19:14:45 -0500 Received: from [192.168.1.4] (/79.36.197.105) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 30 Jul 2012 17:14:45 -0700 Message-ID: <50172373.1090201@oracle.com> Date: Tue, 31 Jul 2012 02:14:43 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Jason Merrill CC: "gcc-patches@gcc.gnu.org" Subject: Re: [C++ Patch] PR 53624 References: <5014052C.1080208@oracle.com> <5016EA40.8050909@redhat.com> <50170A22.7050200@oracle.com> <50170DCA.2050009@redhat.com> In-Reply-To: <50170DCA.2050009@redhat.com> X-IsSubscribed: yes 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 On 07/31/2012 12:42 AM, Jason Merrill wrote: > On 07/30/2012 06:26 PM, Paolo Carlini wrote: >> + if ((cxx_dialect == cxx98) >> + || (TREE_CODE (decl) != FUNCTION_DECL && is_primary)) > > We shouldn't do this check for non-primary templates in C++98 mode, > either. Yes. Thus the below also passes testing. Thanks, Paolo. /////////////////////// Index: testsuite/g++.dg/cpp0x/temp_default5.C =================================================================== --- testsuite/g++.dg/cpp0x/temp_default5.C (revision 0) +++ testsuite/g++.dg/cpp0x/temp_default5.C (revision 0) @@ -0,0 +1,13 @@ +// { dg-options "-std=c++11" } + +template +void Foo(T) +{ + struct X {}; +} + +template +void f(const U&) +{ + auto g = [] () {}; +} Index: cp/pt.c =================================================================== --- cp/pt.c (revision 189981) +++ cp/pt.c (working copy) @@ -4267,7 +4267,8 @@ check_default_tmpl_args (tree decl, tree parms, in /* Core issue 226 (C++0x only): the following only applies to class templates. */ - if ((cxx_dialect == cxx98) || TREE_CODE (decl) != FUNCTION_DECL) + if (is_primary + && ((cxx_dialect == cxx98) || TREE_CODE (decl) != FUNCTION_DECL)) { /* [temp.param] @@ -4299,8 +4300,7 @@ check_default_tmpl_args (tree decl, tree parms, in TREE_PURPOSE (parm) = error_mark_node; no_errors = false; } - else if (is_primary - && !is_partial + else if (!is_partial && !is_friend_decl /* Don't complain about an enclosing partial specialization. */