From patchwork Wed Dec 10 00:39:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 419347 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id EE2AC1400B7 for ; Wed, 10 Dec 2014 11:39:49 +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:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=Kk3m0VA+7WWGRSNwQwLuOEHTTNWzZGp4ZA1BygaE5UWRBJxW9M XOHKgSwpAjHAUv6Qy9DpMZNCack3+s0X5KCe5iHWS9cETmrKXMGbyDoiRGmUDVbj yzuq+gvGjQhnKJADdzTLzwxnzr6aKGR7X3Z4UkPmAC0D2IH0coVI20fuY= 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:mime-version:content-type; s= default; bh=ftifdoD8puoOASDUIj3l+uKt24g=; b=VlPAkVbUbr3x0LxL54bU DjiKnyXec8Pn0m1OMju3Q3lIHdNC9PMRVtKxZutCgImSVR4JTnTO1CuZ8ci15+dR hOeK5JOEGn0EzeerpQpQVnKdcH/hHmBYKtQbuSoV5KkaUby0B7GjVaqeFFysEbZd Y2aLEtFgEbdUn6ZlRFOzg1A= Received: (qmail 24536 invoked by alias); 10 Dec 2014 00:39:43 -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 24518 invoked by uid 89); 10 Dec 2014 00:39:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 10 Dec 2014 00:39:41 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sBA0ddwN022725 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 9 Dec 2014 19:39:39 -0500 Received: from localhost (ovpn-116-46.ams2.redhat.com [10.36.116.46]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sBA0dc84007529; Tue, 9 Dec 2014 19:39:39 -0500 Date: Wed, 10 Dec 2014 00:39:38 +0000 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Cc: gromer@google.com Subject: [patch] Add 'const' to helper functors for std::promise etc. Message-ID: <20141210003938.GI3134@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Thanks to Geoff Romer for suggesting this change, which might be needed if we change std::function to only be able to call const operator() overloads for C++17. Tested x86_64-linux and powerpc64-linux, committed to trunk. commit d4eb711ad60cf2925d8f8f6c622918c648a51e13 Author: Jonathan Wakely Date: Wed Dec 10 00:22:08 2014 +0000 * include/std/future (__future_base::_Setter::operator(), __future_base::_Task_setter::operator()): Make call operators const. diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future index 157ceb3..31aaf98 100644 --- a/libstdc++-v3/include/std/future +++ b/libstdc++-v3/include/std/future @@ -455,7 +455,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION "Invalid specialisation"); // Used by std::promise to copy construct the result. - typename promise<_Res>::_Ptr_type operator()() + typename promise<_Res>::_Ptr_type operator()() const { _State_baseV2::_S_check(_M_promise->_M_future); _M_promise->_M_storage->_M_set(*_M_arg); @@ -470,7 +470,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct _Setter<_Res, _Res&&> { // Used by std::promise to move construct the result. - typename promise<_Res>::_Ptr_type operator()() + typename promise<_Res>::_Ptr_type operator()() const { _State_baseV2::_S_check(_M_promise->_M_future); _M_promise->_M_storage->_M_set(std::move(*_M_arg)); @@ -487,7 +487,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct _Setter<_Res, __exception_ptr_tag> { // Used by std::promise to store an exception as the result. - typename promise<_Res>::_Ptr_type operator()() + typename promise<_Res>::_Ptr_type operator()() const { _State_baseV2::_S_check(_M_promise->_M_future); _M_promise->_M_storage->_M_error = *_M_ex; @@ -1286,7 +1286,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<> struct __future_base::_State_base::_Setter { - promise::_Ptr_type operator()() + promise::_Ptr_type operator()() const { _State_base::_S_check(_M_promise->_M_future); return std::move(_M_promise->_M_storage); @@ -1310,7 +1310,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct __future_base::_Task_setter { // Invoke the function and provide the result to the caller. - _Ptr_type operator()() + _Ptr_type operator()() const { __try { @@ -1333,7 +1333,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct __future_base::_Task_setter<_Ptr_type, _Fn, void> { - _Ptr_type operator()() + _Ptr_type operator()() const { __try {