Cast to base added to avoid a call to the convertir constructor/assignment (see Tickes 1419 and 1420)

[SVN r41381]
This commit is contained in:
Fernando Cacciola
2007-11-25 20:26:14 +00:00
parent 9afdbe65e7
commit 95c864e119

View File

@ -516,7 +516,7 @@ class optional : public optional_detail::optional_base<T>
// Creates a deep copy of another optional<T> // Creates a deep copy of another optional<T>
// Can throw if T::T(T const&) does // Can throw if T::T(T const&) does
optional ( optional const& rhs ) : base(rhs) {} optional ( optional const& rhs ) : base( static_cast<base const&>(rhs) ) {}
// No-throw (assuming T::~T() doesn't) // No-throw (assuming T::~T() doesn't)
~optional() {} ~optional() {}
@ -550,7 +550,7 @@ class optional : public optional_detail::optional_base<T>
// (NOTE: On BCB, this operator is not actually called and left is left UNMODIFIED in case of a throw) // (NOTE: On BCB, this operator is not actually called and left is left UNMODIFIED in case of a throw)
optional& operator= ( optional const& rhs ) optional& operator= ( optional const& rhs )
{ {
this->assign( rhs ) ; this->assign( static_cast<base const&>(rhs) ) ;
return *this ; return *this ;
} }