aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2014-05-02 19:29:48 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2014-05-02 19:29:48 +0100
commit62da5a07b2f56f860e70c9bb66791ac665bf14d8 (patch)
treec23858138f7540ca94f222fa4e1300a2d6a086a1
parenta0e24419cfc3b66a642d00fa7a13b147a8c57c2e (diff)
downloadgcc-62da5a07b2f56f860e70c9bb66791ac665bf14d8.zip
gcc-62da5a07b2f56f860e70c9bb66791ac665bf14d8.tar.gz
gcc-62da5a07b2f56f860e70c9bb66791ac665bf14d8.tar.bz2
re PR libstdc++/61036 (shared_ptr<void>(new T) rejected)
PR libstdc++/61036 * include/bits/shared_ptr_base.h (__shared_ptr::__shared_ptr(_Tp1*)): Check the correct type in the static assertion. * testsuite/20_util/shared_ptr/cons/61036.cc: New. From-SVN: r210015
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/include/bits/shared_ptr_base.h2
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/cons/61036.cc28
3 files changed, 34 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 754530c..5c32a44 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -8,6 +8,11 @@
refer to...
* testsuite/libstdc++-prettyprinters/simple11.cc: New.
+ PR libstdc++/61036
+ * include/bits/shared_ptr_base.h (__shared_ptr::__shared_ptr(_Tp1*)):
+ Check the correct type in the static assertion.
+ * testsuite/20_util/shared_ptr/cons/61036.cc: New.
+
2014-04-27 Tim Shen <timshen91@gmail.com>
* include/bits/regex_automaton.h (_NFA<>::_M_insert_repeat):
diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h
index 57398af..c25157f 100644
--- a/libstdc++-v3/include/bits/shared_ptr_base.h
+++ b/libstdc++-v3/include/bits/shared_ptr_base.h
@@ -871,7 +871,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: _M_ptr(__p), _M_refcount(__p)
{
__glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
- static_assert( !is_void<_Tp>::value, "incomplete type" );
+ static_assert( !is_void<_Tp1>::value, "incomplete type" );
static_assert( sizeof(_Tp1) > 0, "incomplete type" );
__enable_shared_from_this_helper(_M_refcount, __p, __p);
}
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/61036.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/61036.cc
new file mode 100644
index 0000000..9cade66
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/61036.cc
@@ -0,0 +1,28 @@
+// { dg-options "-std=gnu++11" }
+// { dg-do compile }
+
+// Copyright (C) 2014 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/>.
+
+// 20.8.2.2 Template class shared_ptr [util.smartptr.shared]
+
+#include <memory>
+
+void test01()
+{
+ std::shared_ptr<void> p(new int);
+}