From patchwork Wed Feb 14 11:01:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 873319 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-473253-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="JEXx3TKH"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zhGgS3y0dz9t3M for ; Wed, 14 Feb 2018 22:01:39 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=NsPiD3XjKCSwvdH2wpo0N89zvqY/kHwJDoefm3udHd4UQVpo9G OaGe2S8J4qVu9hxuKENySap8CsBmaouzlSbQdGt//Snb+4ejAU9Go0f9CID5s45I 5iog2bvy1RxBjyvn9FJf8ndPnbEF/igfIwnswHWN3k04pWF2YnoYT/0KQ= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=bQBCTNYt6WCiw3arWiVOf7lWL5c=; b=JEXx3TKHZGN37e82kpr0 9ZRAmObQmdHUrFx7C3S8iyOERpxcf/a8yd+w2YrzOQ0vh0hwOTcdaRN38jXfj644 TnTn0spPruKxbVJqOqUW+wik50/Irv7T1nrIlca6rwrPoEhkH7UKZdq3iRz3xRmC qEqImjr32ykz6U22rPrGvCQ= Received: (qmail 42411 invoked by alias); 14 Feb 2018 11:01:33 -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 42402 invoked by uid 89); 14 Feb 2018 11:01:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: aserp2120.oracle.com Received: from aserp2120.oracle.com (HELO aserp2120.oracle.com) (141.146.126.78) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 14 Feb 2018 11:01:31 +0000 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1EAvf2a118799; Wed, 14 Feb 2018 11:01:29 GMT Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2g4jw3892q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Feb 2018 11:01:29 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w1EB1Rfk017314 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 14 Feb 2018 11:01:28 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w1EB1Q6d007203; Wed, 14 Feb 2018 11:01:26 GMT Received: from [192.168.1.4] (/79.52.198.133) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 14 Feb 2018 03:01:25 -0800 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] tsubst_flags_t fixlet Message-ID: <5fd75b08-8b58-7622-f296-83b0bf6259a4@oracle.com> Date: Wed, 14 Feb 2018 12:01:23 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8804 signatures=668670 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802140129 X-IsSubscribed: yes Hi, today, while having a look to c++/84350, I noticed that in a couple of places we aren't forwarding the tsubst_flags_t argument to do_auto_deduction. I think we can elegantly solve the problem by removing the do_auto_deduction overload taking three arguments and adding two defaults to the other. Tested x86_64-linux. Thanks, Paolo. /////////////////// 2018-02-14 Paolo Carlini * cp-tree.h (do_auto_deduction (tree, tree, tree)): Remove. (do_auto_deduction (tree, tree, tree, tsubst_flags_t, auto_deduction_context, tree, int): Add defaults. * pt.c (do_auto_deduction (tree, tree, tree)): Remove definition. (tsubst_omp_for_iterator): Adjust do_auto_deduction call, forward tsubst_flags_t argument. * init.c (build_new): Likewise. Index: cp-tree.h =================================================================== --- cp-tree.h (revision 257653) +++ cp-tree.h (working copy) @@ -6470,10 +6470,11 @@ extern tree make_auto (void); extern tree make_decltype_auto (void); extern tree make_template_placeholder (tree); extern bool template_placeholder_p (tree); -extern tree do_auto_deduction (tree, tree, tree); extern tree do_auto_deduction (tree, tree, tree, - tsubst_flags_t, - auto_deduction_context, + tsubst_flags_t + = tf_warning_or_error, + auto_deduction_context + = adc_unspecified, tree = NULL_TREE, int = LOOKUP_NORMAL); extern tree type_uses_auto (tree); Index: init.c =================================================================== --- init.c (revision 257653) +++ init.c (working copy) @@ -3593,7 +3593,7 @@ build_new (vec **placement, tree type d_init = (**init)[0]; d_init = resolve_nondeduced_context (d_init, complain); } - type = do_auto_deduction (type, d_init, auto_node); + type = do_auto_deduction (type, d_init, auto_node, complain); } } Index: pt.c =================================================================== --- pt.c (revision 257653) +++ pt.c (working copy) @@ -15785,7 +15785,7 @@ tsubst_omp_for_iterator (tree t, int i, tree declv tree auto_node = type_uses_auto (TREE_TYPE (decl)); if (auto_node && init) TREE_TYPE (decl) - = do_auto_deduction (TREE_TYPE (decl), init, auto_node); + = do_auto_deduction (TREE_TYPE (decl), init, auto_node, complain); gcc_assert (!type_dependent_expression_p (decl)); @@ -25941,17 +25941,6 @@ do_class_deduction (tree ptype, tree tmpl, tree in } /* Replace occurrences of 'auto' in TYPE with the appropriate type deduced - from INIT. AUTO_NODE is the TEMPLATE_TYPE_PARM used for 'auto' in TYPE. */ - -tree -do_auto_deduction (tree type, tree init, tree auto_node) -{ - return do_auto_deduction (type, init, auto_node, - tf_warning_or_error, - adc_unspecified); -} - -/* Replace occurrences of 'auto' in TYPE with the appropriate type deduced from INIT. AUTO_NODE is the TEMPLATE_TYPE_PARM used for 'auto' in TYPE. The CONTEXT determines the context in which auto deduction is performed and is used to control error diagnostics. FLAGS are the LOOKUP_* flags.