From patchwork Wed Oct 2 20:22:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 280173 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 48EE52C00AA for ; Thu, 3 Oct 2013 06:22:45 +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:date:message-id:subject:from:to:content-type; q= dns; s=default; b=OB7fCdsA+FCyxHeemoaoST24EFJlOHJjO3Z1Qgvp1WRSA+ NoUm8AKUkyn2XY5LFz+fNf61KQB4HREFBUsgfM5yYZISKokOgq3X2h4PhSH9bHyR 7AWKA+dHyin+lFNgmeviUcexg4c8biM6qxIiY6fRf2vYuywJGgamK4NV0Gy+g= 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:date:message-id:subject:from:to:content-type; s= default; bh=NOK8+mPUZsplFs3LRHNQG8XX/R0=; b=xPNh9VV2vjxdOwCNLpJd OvtA6iCVKRZi8Pm6O2ksjyJ/Y6Op53U0ne26ILS61W6wOWyRFKORpEggMCdpFvZe J/B5MuIf0U43so2KVRTO64mwM5bJCD1V2hoqcYejTmvdYpsSe/PsRZ9s4nXXLwpl u1OO0Fa3kVYEcTETj6FPitU= Received: (qmail 17884 invoked by alias); 2 Oct 2013 20:22: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 17862 invoked by uid 89); 2 Oct 2013 20:22:28 -0000 Received: from mail-la0-f43.google.com (HELO mail-la0-f43.google.com) (209.85.215.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 02 Oct 2013 20:22:28 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, NO_RELAYS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-la0-f43.google.com Received: by mail-la0-f43.google.com with SMTP id ep20so1139129lab.16 for ; Wed, 02 Oct 2013 13:22:24 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.152.228.130 with SMTP id si2mr3463991lac.32.1380745343901; Wed, 02 Oct 2013 13:22:23 -0700 (PDT) Received: by 10.112.101.7 with HTTP; Wed, 2 Oct 2013 13:22:23 -0700 (PDT) Date: Wed, 2 Oct 2013 21:22:23 +0100 Message-ID: Subject: [v3 patch] fix libstdc++/58569 From: Jonathan Wakely To: "libstdc++" , gcc-patches 2013-10-02 Jonathan Wakely Daniel Krugler PR libstdc++/58569 * include/std/functional (function::_CheckResult): Move to namespace scope and rename to __check_func_return_type. * testsuite/20_util/function/58569.cc: New. Tested x86_64-linux, committed to trunk and 4.8 branch commit 2a14c82b439cdce90ac4008e03b69e3e734931c3 Author: Jonathan Wakely Date: Tue Oct 1 11:10:06 2013 +0100 2013-10-02 Jonathan Wakely Daniel Krugler PR libstdc++/58569 * include/std/functional (function::_CheckResult): Move to namespace scope and rename to __check_func_return_type. * testsuite/20_util/function/58569.cc: New. diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional index 73cddfe..eaa4509 100644 --- a/libstdc++-v3/include/std/functional +++ b/libstdc++-v3/include/std/functional @@ -2128,6 +2128,10 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) } }; + template + using __check_func_return_type + = __or_, is_convertible<_From, _To>>; + /** * @brief Primary class template for std::function. * @ingroup functors @@ -2145,16 +2149,8 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) using _Invoke = decltype(__callable_functor(std::declval<_Functor&>()) (std::declval<_ArgTypes>()...) ); - template - struct _CheckResult - : is_convertible<_CallRes, _Res1> { }; - - template - struct _CheckResult<_CallRes, void> - : true_type { }; - template - using _Callable = _CheckResult<_Invoke<_Functor>, _Res>; + using _Callable = __check_func_return_type<_Invoke<_Functor>, _Res>; template using _Requires = typename enable_if<_Cond::value, _Tp>::type; diff --git a/libstdc++-v3/testsuite/20_util/function/58569.cc b/libstdc++-v3/testsuite/20_util/function/58569.cc new file mode 100644 index 0000000..f1e67bc --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/function/58569.cc @@ -0,0 +1,29 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// libstdc++/58569 + +#include + +struct foo { + std::function x; + std::function y; +}; + +foo a;