re PR libstdc++/58569 (Compilation error when a class contains multiple std::function)
2013-10-02 Jonathan Wakely <jwakely.gcc@gmail.com> Daniel Krugler <daniel.kruegler@gmail.com> 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. Co-Authored-By: Daniel Kruegler <daniel.kruegler@gmail.com> From-SVN: r203132
This commit is contained in:
parent
3fd113d7f1
commit
44d209d7e2
|
@ -1,3 +1,11 @@
|
||||||
|
2013-10-02 Jonathan Wakely <jwakely.gcc@gmail.com>
|
||||||
|
Daniel Krugler <daniel.kruegler@gmail.com>
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
2013-10-02 Jonathan Wakely <jwakely.gcc@gmail.com>
|
2013-10-02 Jonathan Wakely <jwakely.gcc@gmail.com>
|
||||||
|
|
||||||
PR libstdc++/58594
|
PR libstdc++/58594
|
||||||
|
|
|
@ -2128,6 +2128,10 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename _From, typename _To>
|
||||||
|
using __check_func_return_type
|
||||||
|
= __or_<is_void<_To>, is_convertible<_From, _To>>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Primary class template for std::function.
|
* @brief Primary class template for std::function.
|
||||||
* @ingroup functors
|
* @ingroup functors
|
||||||
|
@ -2145,16 +2149,8 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
|
||||||
using _Invoke = decltype(__callable_functor(std::declval<_Functor&>())
|
using _Invoke = decltype(__callable_functor(std::declval<_Functor&>())
|
||||||
(std::declval<_ArgTypes>()...) );
|
(std::declval<_ArgTypes>()...) );
|
||||||
|
|
||||||
template<typename _CallRes, typename _Res1>
|
|
||||||
struct _CheckResult
|
|
||||||
: is_convertible<_CallRes, _Res1> { };
|
|
||||||
|
|
||||||
template<typename _CallRes>
|
|
||||||
struct _CheckResult<_CallRes, void>
|
|
||||||
: true_type { };
|
|
||||||
|
|
||||||
template<typename _Functor>
|
template<typename _Functor>
|
||||||
using _Callable = _CheckResult<_Invoke<_Functor>, _Res>;
|
using _Callable = __check_func_return_type<_Invoke<_Functor>, _Res>;
|
||||||
|
|
||||||
template<typename _Cond, typename _Tp>
|
template<typename _Cond, typename _Tp>
|
||||||
using _Requires = typename enable_if<_Cond::value, _Tp>::type;
|
using _Requires = typename enable_if<_Cond::value, _Tp>::type;
|
||||||
|
|
|
@ -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
|
||||||
|
// <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
// libstdc++/58569
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
struct foo {
|
||||||
|
std::function<foo (int)> x;
|
||||||
|
std::function<foo ()> y;
|
||||||
|
};
|
||||||
|
|
||||||
|
foo a;
|
Loading…
Reference in New Issue