The following example (which is a cut-down version of some code which passes a std::auto_ptr through a forwarding function using boost::ref) compiles fine on 4.1.2 and 4.2.3, but fails on 4.3.0 with the error:
ap_ref.cc: In function 'void g(reference_wrapper<auto_ptr<X> >)': ap_ref.cc:23: error: no matching function for call to 'auto_ptr<X>::auto_ptr(auto_ptr<X>)' ap_ref.cc:6: note: candidates are: auto_ptr<T>::auto_ptr(auto_ptr<T>::auto_ptr_ref) [with T = X] ap_ref.cc:5: note: auto_ptr<T>::auto_ptr(auto_ptr<T>&) [with T = X] ap_ref.cc:23: error: initializing argument 1 of 'void f(auto_ptr<X>)' This appears to be treating the result of the conversion operator in reference_wrapper<T> as an rvalue of type T (which cannot initialise a non-const reference) rather than as a non-const reference to T as specified, and expected by the auto_ptr constructor. I'm not 100% sure of the semantics of auto_ptr-related conversions and copy-constructors with non-const arguments, so it's possible I've overlooked something and the code which used to compile isn't actually valid. However FWIW I've also tried it with Comeau, which seems to agree with the older gcc versions and compiles it succesfully. ---- template< typename T > class auto_ptr { struct auto_ptr_ref { }; public: auto_ptr(auto_ptr&); auto_ptr(auto_ptr_ref); operator auto_ptr_ref(); }; template< typename T > class reference_wrapper { public: reference_wrapper(T& t); operator T& () const; }; struct X { }; void f(auto_ptr< X >); void g(reference_wrapper< auto_ptr< X > > r) { f(r); } ---- -- Summary: [4.3 regression] auto_ptr references don't convert Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: zak at transversal dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35773