+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>
-
+
* libsupc++/initializer_list (initializer_list): Add missing typedefs.
2009-05-21 Benjamin Kosnik <bkoz@redhat.com>
template<typename _Signature>
static bool
_M_not_empty_function(const function<_Signature>& __f)
- { return __f; }
+ { return static_cast<bool>(__f); }
template<typename _Tp>
static bool
template<typename _Signature>
inline bool
operator==(const function<_Signature>& __f, _M_clear_type*)
- { return !__f; }
+ { return !static_cast<bool>(__f); }
/// @overload
template<typename _Signature>
inline bool
operator==(_M_clear_type*, const function<_Signature>& __f)
- { return !__f; }
+ { return !static_cast<bool>(__f); }
/**
* @brief Compares a polymorphic function object wrapper against 0
template<typename _Signature>
inline bool
operator!=(const function<_Signature>& __f, _M_clear_type*)
- { return __f; }
+ { return static_cast<bool>(__f); }
/// @overload
template<typename _Signature>
inline bool
operator!=(_M_clear_type*, const function<_Signature>& __f)
- { return __f; }
+ { return static_cast<bool>(__f); }
// [3.7.2.8] specialized algorithms
--- /dev/null
+// { 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;
+}
+
--- /dev/null
+// { 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* ()>;
+}