From 5f031f9747fdfb04213c20d24f109fb5ffc877df Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Wed, 19 Feb 2020 15:01:41 +0000 Subject: 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. --- libstdc++-v3/include/std/numeric | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libstdc++-v3/include/std') 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 - constexpr - enable_if_t<__and_v, bool_constant>, _Tp*> + constexpr enable_if_t, _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 -- cgit v1.1