Pedro pointed out this comment isn't true, see LWG 463 for the reason why (in short, it needs too many user-defined conversions).
* include/backward/auto_ptr.h (dauto_ptr): Correct comment about conversions from auto_ptr<Derived> rvalues to auto_ptr<Base>. * testsuite/20_util/auto_ptr/assign_neg.cc: Remove redundant dg-error directives that only match notes, not errors. Tested powerpc64le-linux, committed to trunk.
commit 39d4ba1f2d08632e0f860fa28b3acfe844cd219d Author: Jonathan Wakely <jwak...@redhat.com> Date: Wed Oct 19 18:48:01 2016 +0100 Fix incorrect comment about std::auto_ptr * include/backward/auto_ptr.h (dauto_ptr): Correct comment about conversions from auto_ptr<Derived> rvalues to auto_ptr<Base>. * testsuite/20_util/auto_ptr/assign_neg.cc: Remove redundant dg-error directives that only match notes, not errors. diff --git a/libstdc++-v3/include/backward/auto_ptr.h b/libstdc++-v3/include/backward/auto_ptr.h index bfd42d8..4dfc8cc 100644 --- a/libstdc++-v3/include/backward/auto_ptr.h +++ b/libstdc++-v3/include/backward/auto_ptr.h @@ -249,13 +249,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Automatic conversions * - * These operations convert an %auto_ptr into and from an auto_ptr_ref - * automatically as needed. This allows constructs such as + * These operations are supposed to convert an %auto_ptr into and from + * an auto_ptr_ref automatically as needed. This would allow + * constructs such as * @code * auto_ptr<Derived> func_returning_auto_ptr(.....); * ... * auto_ptr<Base> ptr = func_returning_auto_ptr(.....); * @endcode + * + * But it doesn't work, and won't be fixed. For further details see + * http://cplusplus.github.io/LWG/lwg-closed.html#463 */ auto_ptr(auto_ptr_ref<element_type> __ref) throw() : _M_ptr(__ref._M_ptr) { } diff --git a/libstdc++-v3/testsuite/20_util/auto_ptr/assign_neg.cc b/libstdc++-v3/testsuite/20_util/auto_ptr/assign_neg.cc index 5e52ec4..22cc49e 100644 --- a/libstdc++-v3/testsuite/20_util/auto_ptr/assign_neg.cc +++ b/libstdc++-v3/testsuite/20_util/auto_ptr/assign_neg.cc @@ -47,6 +47,3 @@ main() test01(); return 0; } -// { dg-error "::auto_ptr|no known conversion" "" { target *-*-* } 136 } -// { dg-error "note" "" { target *-*-* } 154 } -// { dg-error "::auto_ptr|no known conversion" "" { target *-*-* } 264 }