From: Jonathan Wakely Date: Thu, 10 Dec 2015 14:32:16 +0000 (+0000) Subject: Fix dejagnu directives in shared_ptr test X-Git-Tag: upstream/12.2.0~50060 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aca12aff8b947dca6ae65abd3c39c31ea1d4e926;p=platform%2Fupstream%2Fgcc.git Fix dejagnu directives in shared_ptr test PR libstdc++/68825 * include/experimental/bits/shared_ptr.h (__shared_ptr, __weak_ptr, experimental::shared_ptr, experimental::weak_ptr): Constrain assignment operators. * testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc: Change to a compile-only test and change dg-excess-errors to dg-error. From-SVN: r231516 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index c46aede..e29a613 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,12 @@ 2015-12-10 Jonathan Wakely + PR libstdc++/68825 + * include/experimental/bits/shared_ptr.h (__shared_ptr, __weak_ptr, + experimental::shared_ptr, experimental::weak_ptr): Constrain + assignment operators. + * testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc: + Change to a compile-only test and change dg-excess-errors to dg-error. + * doc/doxygen/user.cfg.in: Use EXTENSION_MAPPING tag. Add new headers to INPUT. Remove obsolete XML_SCHEMA and XML_DTD tags. Update PREDEFINED macros. Set BRIEF_MEMBER_DESC for man-pages. diff --git a/libstdc++-v3/include/experimental/bits/shared_ptr.h b/libstdc++-v3/include/experimental/bits/shared_ptr.h index 413652d..bd22f28 100644 --- a/libstdc++-v3/include/experimental/bits/shared_ptr.h +++ b/libstdc++-v3/include/experimental/bits/shared_ptr.h @@ -91,9 +91,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class __shared_ptr<__libfund_v1<_Tp, false>, _Lp> : private __shared_ptr<_Tp, _Lp> { - template + template using _Compatible - = enable_if_t<__sp_compatible<_Tp1, _Tp>::value>; + = enable_if_t<__sp_compatible<_Tp1, _Tp>::value, _Res>; using _Base_type = __shared_ptr<_Tp>; @@ -201,7 +201,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION using _Base_type::operator->; template - __shared_ptr& + _Compatible<_Tp1, __shared_ptr&> operator=(const __shared_ptr<__libfund_v1<_Tp1>, _Lp>& __r) noexcept { _Base_type::operator=(__r._M_get_base()); @@ -209,7 +209,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template - __shared_ptr& + _Compatible<_Tp1, __shared_ptr&> operator=(__shared_ptr<__libfund_v1<_Tp1>, _Lp>&& __r) noexcept { _Base_type::operator=(std::move(__r._M_get_base())); @@ -217,7 +217,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template - __shared_ptr& + _Compatible<_Tp1, __shared_ptr&> operator=(std::unique_ptr<_Tp1>&& __r) { _Base_type::operator=(std::move(__r)); @@ -226,7 +226,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if _GLIBCXX_USE_DEPRECATED template - __shared_ptr& + _Compatible<_Tp1, __shared_ptr&> operator=(std::auto_ptr<_Tp1>&& __r) { _Base_type::operator=(std::move(__r)); @@ -292,26 +292,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION using element_type = remove_extent_t<_Tp>; private: - struct _Array_Deleter + struct _Array_deleter { void operator()(element_type const *__p) const { delete [] __p; } }; - struct _Normal_Deleter - { - void - operator()(element_type const *__p) const - { delete __p; } - }; - - template + template using _Compatible - = enable_if_t<__sp_compatible<_Tp1, _Tp>::value>; - - using _Deleter_type - = conditional_t::value, _Array_Deleter, _Normal_Deleter>; + = enable_if_t<__sp_compatible<_Tp1, _Tp>::value, _Res>; using _Base_type = __shared_ptr; @@ -325,7 +315,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template explicit __shared_ptr(_Tp1* __p) - : _Base_type(__p, _Deleter_type()) + : _Base_type(__p, _Array_deleter()) { } template @@ -402,7 +392,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION reset(_Tp1* __p) { _GLIBCXX_DEBUG_ASSERT(__p == 0 || __p != get()); - __shared_ptr(__p, _Deleter_type()).swap(*this); + __shared_ptr(__p, _Array_deleter()).swap(*this); } template @@ -423,7 +413,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template - __shared_ptr& + _Compatible<_Tp1, __shared_ptr&> operator=(const __shared_ptr<__libfund_v1<_Tp1>, _Lp>& __r) noexcept { _Base_type::operator=(__r._M_get_base()); @@ -431,7 +421,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template - __shared_ptr& + _Compatible<_Tp1, __shared_ptr&> operator=(__shared_ptr<__libfund_v1<_Tp1>, _Lp>&& __r) noexcept { _Base_type::operator=(std::move(__r._M_get_base())); @@ -439,7 +429,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template - __shared_ptr& + _Compatible<_Tp1, __shared_ptr&> operator=(std::unique_ptr<_Tp1>&& __r) { _Base_type::operator=(std::move(__r)); @@ -448,7 +438,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if _GLIBCXX_USE_DEPRECATED template - __shared_ptr& + _Compatible<_Tp1, __shared_ptr&> operator=(std::auto_ptr<_Tp1>&& __r) { _Base_type::operator=(std::move(__r)); @@ -509,8 +499,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class __weak_ptr<__libfund_v1<_Tp>, _Lp> : __weak_ptr, _Lp> { - template - using _Compatible = enable_if_t<__sp_compatible<_Tp1, _Tp>::value>; + template + using _Compatible + = enable_if_t<__sp_compatible<_Tp1, _Tp>::value, _Res>; using _Base_type = __weak_ptr>; @@ -551,7 +542,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator=(const __weak_ptr& __r) noexcept = default; template - __weak_ptr& + _Compatible<_Tp1, __weak_ptr&> operator=(const __weak_ptr<__libfund_v1<_Tp1>, _Lp>& __r) noexcept { this->_Base_type::operator=(__r._M_get_base()); @@ -559,7 +550,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template - __weak_ptr& + _Compatible<_Tp1, __weak_ptr&> operator=(const __shared_ptr<_Tp1, _Lp>& __r) noexcept { this->_Base_type::operator=(__r._M_get_base()); @@ -574,7 +565,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template - __weak_ptr& + _Compatible<_Tp1, __weak_ptr&> operator=(__weak_ptr<_Tp1, _Lp>&& __r) noexcept { this->_Base_type::operator=(std::move(__r._M_get_base())); @@ -639,8 +630,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template class shared_ptr : public __shared_ptr<_Tp> { - template - using _Compatible = enable_if_t<__sp_compatible<_Tp1, _Tp>::value>; + template + using _Compatible + = enable_if_t<__sp_compatible<_Tp1, _Tp>::value, _Res>; using _Base_type = __shared_ptr<_Tp>; @@ -713,7 +705,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION shared_ptr& operator=(const shared_ptr&) noexcept = default; template - shared_ptr& + _Compatible<_Tp1, shared_ptr&> operator=(const shared_ptr<_Tp1>& __r) noexcept { _Base_type::operator=(__r); @@ -728,7 +720,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template - shared_ptr& + _Compatible<_Tp1, shared_ptr&> operator=(shared_ptr<_Tp1>&& __r) noexcept { _Base_type::operator=(std::move(__r)); @@ -737,7 +729,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if _GLIBCXX_USE_DEPRECATED template - shared_ptr& + _Compatible<_Tp1, shared_ptr&> operator=(std::auto_ptr<_Tp1>&& __r) { __shared_ptr<_Tp>::operator=(std::move(__r)); @@ -746,7 +738,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif template - shared_ptr& + _Compatible<_Tp1, shared_ptr&> operator=(unique_ptr<_Tp1, _Del>&& __r) { _Base_type::operator=(std::move(__r)); @@ -933,8 +925,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template class weak_ptr : public __weak_ptr<_Tp> { - template - using _Compatible = enable_if_t<__sp_compatible<_Tp1, _Tp>::value>; + template + using _Compatible + = enable_if_t<__sp_compatible<_Tp1, _Tp>::value, _Res>; using _Base_type = __weak_ptr<_Tp>; @@ -961,7 +954,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator=(const weak_ptr& __r) noexcept = default; template - weak_ptr& + _Compatible<_Tp1, weak_ptr&> operator=(const weak_ptr<_Tp1>& __r) noexcept { this->_Base_type::operator=(__r); @@ -969,7 +962,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template - weak_ptr& + _Compatible<_Tp1, weak_ptr&> operator=(const shared_ptr<_Tp1>& __r) noexcept { this->_Base_type::operator=(__r); @@ -980,7 +973,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator=(weak_ptr&& __r) noexcept = default; template - weak_ptr& + _Compatible<_Tp1, weak_ptr&> operator=(weak_ptr<_Tp1>&& __r) noexcept { this->_Base_type::operator=(std::move(__r)); diff --git a/libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc b/libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc index d3c94cf..b2691e9 100644 --- a/libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc +++ b/libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc @@ -1,4 +1,5 @@ // { dg-options "-std=gnu++1y" } +// { dg-do compile } // Copyright (C) 2015 Free Software Foundation, Inc. // @@ -19,11 +20,9 @@ // 8.2.1 Class template shared_ptr [memory.smartptr.shared] - #include #include - struct A { virtual ~A() { } }; struct B : A { }; @@ -38,7 +37,7 @@ test01() bool test __attribute__((unused)) = true; std::experimental::shared_ptr a; - a = std::experimental::shared_ptr (new B[3]); // { dg-excess-errors "no matching" } + a = std::experimental::shared_ptr (new B[3]); // { dg-error "no match " } } void @@ -47,7 +46,7 @@ test02() bool test __attribute__((unused)) = true; std::experimental::shared_ptr a(new A[3]); - std::experimental::shared_ptr spa(a); // { dg-excess-errors "no matching" } + std::experimental::shared_ptr spa(a); // { dg-error "no matching" } } int