diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2020-02-19 15:01:41 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2020-02-19 15:28:45 +0000 |
commit | 5f031f9747fdfb04213c20d24f109fb5ffc877df (patch) | |
tree | 658c7d6af15e28d790c40d72f9fc488a0d316e37 /libstdc++-v3/include/std/numeric | |
parent | 66ae31eb308e5bc90ce6dfd0a67381a0929a6aa0 (diff) | |
download | gcc-5f031f9747fdfb04213c20d24f109fb5ffc877df.zip gcc-5f031f9747fdfb04213c20d24f109fb5ffc877df.tar.gz gcc-5f031f9747fdfb04213c20d24f109fb5ffc877df.tar.bz2 |
libstdc++: midpoint should not constrain T is complete (LWG 3200)
* include/std/numeric (midpoint(T8, T*)): Do not check for complete
type during overload resolution, use static assert instead (LWG 3200).
* testsuite/26_numerics/midpoint/pointer.cc: Do not test with
incomplete type.
* testsuite/26_numerics/midpoint/pointer_neg.cc: New test.
Diffstat (limited to 'libstdc++-v3/include/std/numeric')
-rw-r--r-- | libstdc++-v3/include/std/numeric | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libstdc++-v3/include/std/numeric b/libstdc++-v3/include/std/numeric index 0b0a8ff..cf35191 100644 --- a/libstdc++-v3/include/std/numeric +++ b/libstdc++-v3/include/std/numeric @@ -208,10 +208,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template<typename _Tp> - constexpr - enable_if_t<__and_v<is_object<_Tp>, bool_constant<sizeof(_Tp) != 0>>, _Tp*> + constexpr enable_if_t<is_object_v<_Tp>, _Tp*> midpoint(_Tp* __a, _Tp* __b) noexcept { + static_assert( sizeof(_Tp) != 0, "type must be complete" ); return __a + (__b - __a) / 2; } _GLIBCXX_END_NAMESPACE_VERSION |