https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85089

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
std::minmax returns a pair<const double&, const double&> which refers to the
original inputs, so you are doing this:

std::pair<double, double> a{ 2, 1 };
std::pair<const double&, const double&> a2{a.second, a.first};
a = a2;

which is equivalent to:

a.first = a.second;
a.second = a.first;

Obviously this can't preserve both original values.

Reply via email to