aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/std/numeric
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2019-05-24 16:39:35 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2019-05-24 16:39:35 +0100
commit09b4000c7c5b359ec62b5d621daf6ab95233ce10 (patch)
treed1955671c56d1a18942b8494f57a049d9bfc0b51 /libstdc++-v3/include/std/numeric
parente8daba7e0630c75c1e1d989f18c282b43fc2e1ef (diff)
downloadgcc-09b4000c7c5b359ec62b5d621daf6ab95233ce10.zip
gcc-09b4000c7c5b359ec62b5d621daf6ab95233ce10.tar.gz
gcc-09b4000c7c5b359ec62b5d621daf6ab95233ce10.tar.bz2
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
Diffstat (limited to 'libstdc++-v3/include/std/numeric')
-rw-r--r--libstdc++-v3/include/std/numeric2
1 files changed, 1 insertions, 1 deletions
diff --git a/libstdc++-v3/include/std/numeric b/libstdc++-v3/include/std/numeric
index 4858ad1..9dff247 100644
--- a/libstdc++-v3/include/std/numeric
+++ b/libstdc++-v3/include/std/numeric
@@ -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