Fix std::midpoint(T*, T*) for reversed arguments
* include/std/numeric (midpoint(T*, T*)): Fix incorrect result. * testsuite/26_numerics/midpoint/pointer.cc: Change "compile" test to "run". From-SVN: r271606
This commit is contained in:
parent
e8daba7e06
commit
09b4000c7c
|
@ -1,5 +1,9 @@
|
|||
2019-05-24 Jonathan Wakely <jwakely@redhat.com>
|
||||
|
||||
* include/std/numeric (midpoint(T*, T*)): Fix incorrect result.
|
||||
* testsuite/26_numerics/midpoint/pointer.cc: Change "compile" test
|
||||
to "run".
|
||||
|
||||
* testsuite/20_util/shared_ptr/cons/alias-rval.cc: Fix test.
|
||||
* testsuite/20_util/shared_ptr/cons/alias.cc: Remove unused function.
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ template<typename _Tp>
|
|||
enable_if_t<__and_v<is_object<_Tp>, bool_constant<sizeof(_Tp) != 0>>, _Tp*>
|
||||
midpoint(_Tp* __a, _Tp* __b) noexcept
|
||||
{
|
||||
return __a > __b ? __b + (__a - __b) / 2 : __a + (__b - __a) / 2;
|
||||
return __a + (__b - __a) / 2;
|
||||
}
|
||||
#endif // C++20
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// { dg-options "-std=gnu++2a" }
|
||||
// { dg-do compile { target c++2a } }
|
||||
// { dg-do run { target c++2a } }
|
||||
|
||||
#include <numeric>
|
||||
#include <climits>
|
||||
|
|
Loading…
Reference in New Issue