2017-02-11 Jonathan Wakely <jwakely@redhat.com>
+ PR libstdc++/79467
+ * include/bits/shared_ptr_base.h (__shared_ptr(_Yp*, _Deleter))
+ (__shared_ptr(_Yp*, _Deleter, _Alloc)): Use lvalue types in
+ __is_callable check.
+ * testsuite/20_util/shared_ptr/cons/79467.cc: New.
+
* include/bits/atomic_base.h: Re-indent.
2017-02-10 Gerald Pfeifer <gerald@pfeifer.com>
__shared_ptr(_Yp* __p, _Deleter __d)
: _M_ptr(__p), _M_refcount(__p, __d)
{
- static_assert(__is_callable<_Deleter(_Yp*)>::value,
+ static_assert(__is_callable<_Deleter&(_Yp*&)>::value,
"deleter expression d(p) is well-formed");
_M_enable_shared_from_this_with(__p);
}
__shared_ptr(_Yp* __p, _Deleter __d, _Alloc __a)
: _M_ptr(__p), _M_refcount(__p, __d, std::move(__a))
{
- static_assert(__is_callable<_Deleter(_Yp*)>::value,
+ static_assert(__is_callable<_Deleter&(_Yp*&)>::value,
"deleter expression d(p) is well-formed");
_M_enable_shared_from_this_with(__p);
}
--- /dev/null
+// Copyright (C) 2017 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/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <memory>
+
+struct D {
+ void operator()(int*&) & {} // PR libstdc++/79467
+};
+
+std::shared_ptr<int> p(new int, D());
+std::shared_ptr<int> q(new int, D(), std::allocator<int>());