From patchwork Sun Sep 15 21:52:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Butcher X-Patchwork-Id: 275075 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 43A542C011D for ; Mon, 16 Sep 2013 07:52:37 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:content-type:content-transfer-encoding:date:from :to:cc:subject:in-reply-to:references:message-id; q=dns; s= default; b=lzX0aJvyad3sG88wzFXd35kMwq08I0JETtw0k2cFKxXw/NLa1LWaA Pfo83OqIsLBBXarQ+uaiP/bU249ZN/n4tvEtGyLuv2Twiuq3gEpBHKdLNvpJhwWd 53NfJ/UtBrqaRkG2aC9BnD8829vpPfhMcntAmdwRNSlNqaW6KCpCV4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:content-type:content-transfer-encoding:date:from :to:cc:subject:in-reply-to:references:message-id; s=default; bh= /I5ka12k0lndkG5P7ZZKaCi2jg4=; b=rYgyqYAilmSpfVMFEw4a/0Jw4adxtXT+ BXOXDtUVo+skOAe7HIwcv1mUAZOWaa7lGb8+7Lxiz70RcHP1dQyqfJ1f0k5NPw3B rsYLvFN3DxWz8MvvVY9bGXJ8fbZ4zNyCd+EVvl5Pq/Th87idQTg0tNNlPik1TlY1 VuT1XbiABMM= Received: (qmail 30122 invoked by alias); 15 Sep 2013 21:52:29 -0000 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 Received: (qmail 30112 invoked by uid 89); 15 Sep 2013 21:52:29 -0000 Received: from avasout07.plus.net (HELO avasout07.plus.net) (84.93.230.235) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 15 Sep 2013 21:52:29 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED, RCVD_IN_SEMBLACK, RDNS_NONE autolearn=no version=3.3.2 X-HELO: avasout07.plus.net Received: from webmail.plus.net ([84.93.228.66]) by avasout07 with smtp id RZsQ1m0031SbfYc01ZsQnL; Sun, 15 Sep 2013 22:52:25 +0100 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=a6YJqyiF c=1 sm=1 tr=0 a=C5+YawzV8SR07mwocaP9vA==:117 a=rJgRRbfb+UpHm5KwX9t5uQ==:17 a=0Bzu9jTXAAAA:8 a=EDeDkkTReK4A:10 a=dYCPD3cKDi0A:10 a=mEurlmlB6I4A:10 a=5LfTt-Tm1vgA:10 a=IkcTkHD0fZMA:10 a=ZBkl__CYAAAA:8 a=mrHjP8x4AAAA:8 a=7vtFykjVAAAA:8 a=mdZtyYuJcKgA:10 a=DP_Vn5gMFnirdHOV_YAA:9 a=T6XbrI0r_u8lUpJa:21 a=cMfU3_vD5qZoh2WQ:21 a=QEXdDO2ut3YA:10 X-AUTH: jessaminenet+adam:2501 Received: from munkyhouse.force9.co.uk ([84.92.244.81]) by webmail.plus.net with HTTP (HTTP/1.1 POST); Sun, 15 Sep 2013 22:52:24 +0100 MIME-Version: 1.0 Date: Sun, 15 Sep 2013 22:52:24 +0100 From: Adam Butcher To: Jason Merrill Cc: Gabriel Dos Reis , Andrew Sutton , Gcc Patches Subject: Re: Generic lambda and implicit function template commits reverted In-Reply-To: <5235C825.30006@redhat.com> References: <1d1d419f76ca0b56520726b3e3cf5ac1@imap.force9.net> <5235C825.30006@redhat.com> Message-ID: <69e9a9f9100bfb81c67bd88fb2248188@imap.force9.net> X-Sender: adam@jessamine.co.uk User-Agent: Roundcube Webmail/0.7.4 On 15.09.2013 15:45, Jason Merrill wrote: > On 09/15/2013 06:22 AM, Adam Butcher wrote: >> [PATCH 1/5] Fix uninitialized variables causing breakage with >> -Werror. >> [PATCH 2/5] Don't accept 'auto' as the 'type' of a template >> parameter. > > OK. > I've also added a case for rejecting 'auto' in a catch parameter. >> [PATCH 3/5] Fix location diagnostics by returning to the deprecated >> 'input_location' global; must be a better fix for this. >> >> Don't know why 'location_of (type)' gave ":" rather >> than >> "file:line:col:". My current workaround is to return to using >> 'input_location'. This gives the correct result but I doubt it >> is >> acceptable. > > This seems to be because make_auto_1 sets the location of the auto > type to BUILTINS_LOCATION; I don't remember why I did that. Changing > it to use input_location seems appropriate. > Thanks. Doing that makes this patch unnecessary. >> [PATCH 4/5] Lift CALL_FROM_THUNK_P setting to above the potential >> 'build_cplus_new' call to prevent ICE due to unexpected >> tree type. >> Rather than this, I've moved the call to 'build_cplus_new' back down to after 'start_preparsed_function' as I needed to call 'set_flags_from_callee' prior to it but within function scope to prevent regression of 49260 and 47263. Deltas below. No regressions in g++.dg with these updates. Cheers, Adam Subject: [PATCH] * pt.c (make_auto_1): Use input_location rather than BUILTINS_LOCATION. --- typedef auto autot; // { dg-error "auto" } -- diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 58f920e..70f13bb 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -20925,7 +20925,7 @@ static tree make_auto_1 (tree name) { tree au = cxx_make_type (TEMPLATE_TYPE_PARM); - TYPE_NAME (au) = build_decl (BUILTINS_LOCATION, + TYPE_NAME (au) = build_decl (input_location, TYPE_DECL, name, au); TYPE_STUB_DECL (au) = TYPE_NAME (au); TEMPLATE_TYPE_PARM_INDEX (au) = build_template_parm_index -- [PATCH] Move 'build_cplus_new' call to after 'start_preparsed_function' and call 'set_flags_from_callee' prior to prevent ICE due to unexpected tree type and fix exception handling. --- diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c index 0da22fd..c9118d8 100644 --- a/gcc/cp/lambda.c +++ b/gcc/cp/lambda.c @@ -885,13 +885,10 @@ maybe_add_lambda_conv_op (tree type) } } else - { call = build_call_a (callop, direct_argvec->length (), direct_argvec->address ()); - if (MAYBE_CLASS_TYPE_P (TREE_TYPE (call))) - call = build_cplus_new (TREE_TYPE (call), call, tf_warning_or_error); - } + CALL_FROM_THUNK_P (call) = 1; tree stattype = build_function_type (fn_result, FUNCTION_ARG_CHAIN (callop)); @@ -987,6 +984,12 @@ maybe_add_lambda_conv_op (tree type) } tree body = begin_function_body (); tree compound_stmt = begin_compound_stmt (0); + if (!generic_lambda_p) + { + set_flags_from_callee (call); + if (MAYBE_CLASS_TYPE_P (TREE_TYPE (call))) + call = build_cplus_new (TREE_TYPE (call), call, tf_warning_or_error); + } call = convert_from_reference (call); finish_return_stmt (call); -- [PATCH] Don't allow 'auto' in type of catch parameter. --- diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 6a4e863..80ceca1 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -10328,6 +10328,11 @@ grokdeclarator (const cp_declarator *declarator, error ("template parameter declared %"); type = error_mark_node; } + else if (decl_context == CATCHPARM) + { + error ("catch parameter declared %"); + type = error_mark_node; + } else if (current_class_type && LAMBDA_TYPE_P (current_class_type)) { if (cxx_dialect < cxx1y) -- [PATCH] cpp0x/auto9.C: Downgrade expected error to expected pedwarn. --- diff --git a/gcc/testsuite/g++.dg/cpp0x/auto9.C b/gcc/testsuite/g++.dg/cpp0x/auto9.C index 190bfa6..f357f2b 100644 --- a/gcc/testsuite/g++.dg/cpp0x/auto9.C +++ b/gcc/testsuite/g++.dg/cpp0x/auto9.C @@ -117,8 +117,8 @@ template struct G {}; // { dg-error "auto" } template struct H { H (); ~H (); }; H h; // { dg-error "invalid" } -void qq (auto); // { dg-error "auto" } -void qr (auto*); // { dg-error "auto" } +void qq (auto); // { dg-warning "auto" } +void qr (auto*); // { dg-warning "auto" } // PR c++/46145