[Boost-bugs] [Boost C++ Libraries] #10834: ptr_array cannot be used with boost::nullable<T> as type parameter

Subject: [Boost-bugs] [Boost C++ Libraries] #10834: ptr_array cannot be used with boost::nullable<T> as type parameter
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-12-02 09:45:51


#10834: ptr_array cannot be used with boost::nullable<T> as type parameter
----------------------------------+---------------------------
 Reporter: florian.schmid1978@… | Owner: nesotto
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: ptr_container
  Version: Boost 1.57.0 | Severity: Problem
 Keywords: |
----------------------------------+---------------------------
 The copy constructor of ptr_array uses operator[] to access the elements
 of the ptr_array to copy.[[BR]]
 Problem one: It is not save to call ptr_array[i] if element i is
 null.[[BR]]
 Problem two: Operator[] returns a reference to remove_nullable<T>::type.
 The address of this object is then casted to const T*, which fails with
 compilation error C2664 if T=nullable<X>, because X* cannot be casted to
 nullable<X>*.

 Reproduction: compile attached test.cpp[[BR]]
 Possible fix: see attached patch[[BR]]
 [[BR]]
 Regards,
 Florian

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10834>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC