aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2017-02-11 21:08:11 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2017-02-11 21:08:11 +0000
commit99ebfe90756a3bd3c94828c56a102f886b919673 (patch)
treea9a8cc9d87f40928689ebf59534a0b894f7e9c86
parentfe701c775e2c706a2e7cbb465563e23086a6adc7 (diff)
downloadgcc-99ebfe90756a3bd3c94828c56a102f886b919673.zip
gcc-99ebfe90756a3bd3c94828c56a102f886b919673.tar.gz
gcc-99ebfe90756a3bd3c94828c56a102f886b919673.tar.bz2
PR libstdc++/79467 use lvalues in is_callable check
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. From-SVN: r245363
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/include/bits/shared_ptr_base.h4
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/cons/79467.cc27
3 files changed, 35 insertions, 2 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 0f6de92..4f5656b 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,11 @@
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>
diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h
index 3b8a5c7..770a094 100644
--- a/libstdc++-v3/include/bits/shared_ptr_base.h
+++ b/libstdc++-v3/include/bits/shared_ptr_base.h
@@ -1085,7 +1085,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__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);
}
@@ -1095,7 +1095,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__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);
}
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/79467.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/79467.cc
new file mode 100644
index 0000000..bcf9654
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/79467.cc
@@ -0,0 +1,27 @@
+// 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>());