re PR libstdc++/40273 ([C++0x] Invalid conversion to bool is reported)
2009-05-27 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/40273 * include/tr1_impl/functional: Add explicit cast. * testsuite/20_util/function/requirements/ explicit_instantiation.cc: New. * testsuite/20_util/function/null_pointer_comparisons.cc: New. From-SVN: r147930
This commit is contained in:
parent
667e6f8924
commit
626e0599af
4 changed files with 84 additions and 6 deletions
|
@ -1,5 +1,13 @@
|
||||||
|
2009-05-27 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
|
||||||
|
PR libstdc++/40273
|
||||||
|
* include/tr1_impl/functional: Add explicit cast.
|
||||||
|
* testsuite/20_util/function/requirements/
|
||||||
|
explicit_instantiation.cc: New.
|
||||||
|
* testsuite/20_util/function/null_pointer_comparisons.cc: New.
|
||||||
|
|
||||||
2009-05-24 Eelis van der Weegen <eelis@eelis.net>
|
2009-05-24 Eelis van der Weegen <eelis@eelis.net>
|
||||||
|
|
||||||
* libsupc++/initializer_list (initializer_list): Add missing typedefs.
|
* libsupc++/initializer_list (initializer_list): Add missing typedefs.
|
||||||
|
|
||||||
2009-05-21 Benjamin Kosnik <bkoz@redhat.com>
|
2009-05-21 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
|
|
@ -1557,7 +1557,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
|
||||||
template<typename _Signature>
|
template<typename _Signature>
|
||||||
static bool
|
static bool
|
||||||
_M_not_empty_function(const function<_Signature>& __f)
|
_M_not_empty_function(const function<_Signature>& __f)
|
||||||
{ return __f; }
|
{ return static_cast<bool>(__f); }
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
static bool
|
static bool
|
||||||
|
@ -2095,13 +2095,13 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
|
||||||
template<typename _Signature>
|
template<typename _Signature>
|
||||||
inline bool
|
inline bool
|
||||||
operator==(const function<_Signature>& __f, _M_clear_type*)
|
operator==(const function<_Signature>& __f, _M_clear_type*)
|
||||||
{ return !__f; }
|
{ return !static_cast<bool>(__f); }
|
||||||
|
|
||||||
/// @overload
|
/// @overload
|
||||||
template<typename _Signature>
|
template<typename _Signature>
|
||||||
inline bool
|
inline bool
|
||||||
operator==(_M_clear_type*, const function<_Signature>& __f)
|
operator==(_M_clear_type*, const function<_Signature>& __f)
|
||||||
{ return !__f; }
|
{ return !static_cast<bool>(__f); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Compares a polymorphic function object wrapper against 0
|
* @brief Compares a polymorphic function object wrapper against 0
|
||||||
|
@ -2113,13 +2113,13 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
|
||||||
template<typename _Signature>
|
template<typename _Signature>
|
||||||
inline bool
|
inline bool
|
||||||
operator!=(const function<_Signature>& __f, _M_clear_type*)
|
operator!=(const function<_Signature>& __f, _M_clear_type*)
|
||||||
{ return __f; }
|
{ return static_cast<bool>(__f); }
|
||||||
|
|
||||||
/// @overload
|
/// @overload
|
||||||
template<typename _Signature>
|
template<typename _Signature>
|
||||||
inline bool
|
inline bool
|
||||||
operator!=(_M_clear_type*, const function<_Signature>& __f)
|
operator!=(_M_clear_type*, const function<_Signature>& __f)
|
||||||
{ return __f; }
|
{ return static_cast<bool>(__f); }
|
||||||
|
|
||||||
// [3.7.2.8] specialized algorithms
|
// [3.7.2.8] specialized algorithms
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
// { dg-options "-std=gnu++0x" }
|
||||||
|
// { dg-do compile }
|
||||||
|
|
||||||
|
// Copyright (C) 2009 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/>.
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
// libstdc++/40273
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
std::function<void* ()> f = 0;
|
||||||
|
if (f != 0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 != f)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
if (f == 0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 == f)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
// { dg-options "-std=gnu++0x" }
|
||||||
|
// { dg-do compile }
|
||||||
|
|
||||||
|
// Copyright (C) 2009 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/>.
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
template class function<void* ()>;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue