2018-09-11 Jonathan Wakely <jwakely@redhat.com>
+ PR libstdc++/87278
+ * include/bits/shared_ptr.h (make_shared): Use remove_cv instead of
+ remove_const.
+ * testsuite/20_util/shared_ptr/creation/87278.cc: New test.
+
Implement LWG 2905 changes to constrain unique_ptr constructors
* include/bits/unique_ptr.h (__uniq_ptr_impl): Add assertions to
check deleter type.
inline shared_ptr<_Tp>
make_shared(_Args&&... __args)
{
- typedef typename std::remove_const<_Tp>::type _Tp_nc;
+ typedef typename std::remove_cv<_Tp>::type _Tp_nc;
return std::allocate_shared<_Tp>(std::allocator<_Tp_nc>(),
std::forward<_Args>(__args)...);
}
--- /dev/null
+// Copyright (C) 2018 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>
+
+void
+test01()
+{
+ std::make_shared<volatile int>();
+}