From patchwork Mon Jan 9 11:09:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 90390 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp26218qgi; Mon, 9 Jan 2017 03:09:32 -0800 (PST) X-Received: by 10.98.96.135 with SMTP id u129mr81618365pfb.141.1483960172348; Mon, 09 Jan 2017 03:09:32 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id b5si61744059pll.139.2017.01.09.03.09.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Jan 2017 03:09:32 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-445668-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-445668-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-445668-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=HEcUdCxkyVVwgrACJ PGxn6c5+ANp4EfU+xrwoF4B2Mvvq4q6HelromBKqTVzqjnIVdznvZD0nZ/Tf8qLS SRxfeGivb88fvu/0vEocjGF61DxycbBwWFq4RIQ2H1hIGGMTnhmejTwIq0SM6z5J 80N1cyM1zLm4356L6zBsH5bRaM= 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:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=default; bh=PnkLYeFvduymbTRzAiW2pao D/Ek=; b=PPdz6SaDoF6376YPyexJxYBqs/LVbMrS+itj0XvOSYsAIw41VHSCrJk YjZmVl+71CGZBNc9oXnddAeZmEi24826/P0ucBJ30Q6gmye2uMFPe9Y2TrBO2JT4 SsExU/OJTFwdIU5/kmlssFapcoHMb5S4V41y7Rqnmq8TPekA0DTg= Received: (qmail 32702 invoked by alias); 9 Jan 2017 11:09:20 -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 32682 invoked by uid 89); 9 Jan 2017 11:09:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.1 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2756, H*MI:sk:58736E6, H*i:sk:58736E6, H*f:sk:58736E6 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 09 Jan 2017 11:09:09 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8A28CC057FA7; Mon, 9 Jan 2017 11:09:09 +0000 (UTC) Received: from localhost (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v09B98kl015339; Mon, 9 Jan 2017 06:09:09 -0500 Date: Mon, 9 Jan 2017 11:09:07 +0000 From: Jonathan Wakely To: Kyrill Tkachov Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: [PATCH] PR78991 make __gnu_cxx::__ops constructors explicit Message-ID: <20170109110907.GF13348@redhat.com> References: <20170106124017.GA7408@redhat.com> <58736866.3090209@foss.arm.com> <20170109104746.GA15819@redhat.com> <58736E6E.8040005@foss.arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <58736E6E.8040005@foss.arm.com> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.7.1 (2016-10-04) On 09/01/17 11:05 +0000, Kyrill Tkachov wrote: > >On 09/01/17 10:47, Jonathan Wakely wrote: >>On 09/01/17 10:39 +0000, Kyrill Tkachov wrote: >>>Hi Jonathan, >>> >>>On 06/01/17 12:40, Jonathan Wakely wrote: >>>>This solves a problem when using libstdc++ with Clang, due to Clang >>>>more eagerly instantiating constexpr function templates during >>>>argument deduction. G++ has some shortcuts to avoid this problem, but >>>>Clang doesn't, and it's not clear that it's strictly speaking a bug in >>>>Clang or if it's following the standard. By making these constructors >>>>explicit we stop them being considered by overload resolution for >>>>copying these functors, which stops us ending up back in the >>>>std::function SFINAE checks. >>>> >>>>I'm also using _GLIBCXX_MOVE to turn some internal copies into moves, >>>>because otherwise using something like std::function with >>>>results in a number of potentially expensive copies. >>>> >>>> PR libstdc++/78991 >>>> * include/bits/predefined_ops.h (_Iter_comp_iter, _Iter_comp_val) >>>> (_Val_comp_iter, _Iter_equals_val, _Iter_pred, _Iter_comp_to_val) >>>> (_Iter_comp_to_iter, _Iter_negate): Make constructors explicit and >>>> move function objects. >>>> (__iter_comp_iter, __iter_comp_val, __val_comp_iter, __pred_iter) >>>> (__iter_comp_val, __iter_comp_iter, __negate): Move function objects. >>>> * testsuite/25_algorithms/sort/78991.cc: New test. >>>> >>>>Tested powerpc64le-linux, committed to trunk. >>>> >>>>I'll backport the 'explicit' constructors (but not the _GLIBCXX_MOVE >>>>changes) to the branches too. >>>> >>> >>>I see this test fail on the GCC 5 branch on arm and aarch64 (error message pasted below). >>>Does the test need a gnu++11 guard or something on the branch? >> >>I thought I'd changed that before committing, I'll fix it. >> >Thanks. >Also, I think 30_threads/thread/cons/lwg2097.cc needs something similar. Yes. I fixed both those tests on my testing machine, but not on the one where I committed from. Committed to gcc-5-branch. commit ea8019b493c1aa6b223969ec5f1153e6f381acde Author: Jonathan Wakely Date: Mon Jan 9 11:06:56 2017 +0000 Add missing dg-options to C++11 test. * testsuite/30_threads/thread/cons/lwg2097.cc: Compile with -std=gnu++11. diff --git a/libstdc++-v3/testsuite/30_threads/thread/cons/lwg2097.cc b/libstdc++-v3/testsuite/30_threads/thread/cons/lwg2097.cc index 3ec4325..d5d6288 100644 --- a/libstdc++-v3/testsuite/30_threads/thread/cons/lwg2097.cc +++ b/libstdc++-v3/testsuite/30_threads/thread/cons/lwg2097.cc @@ -1,3 +1,4 @@ +// { dg-options "-std=gnu++11" } // { dg-do compile } // { dg-require-cstdint "" } // { dg-require-gthreads "" }