https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78130
--- Comment #5 from Markus Trippelsdorf <trippels at gcc dot gnu.org> --- markus@x4 tmp % cat string_span_tests.ii class A { public: using index_type = int; index_type m_fn1() { return size_; } index_type size_; }; struct B { using element_type = int; using index_type = int; using pointer = element_type; B(pointer, index_type); void m_fn2(index_type p1) { int a = m_fn3(); if (__builtin_expect(p1 <= a, 1)) throw; } index_type m_fn3() { return storage_.m_fn1(); } A storage_; }; struct C { using impl_type = B; C(impl_type); void m_fn4() { int b = span_.m_fn3(); span_.m_fn2(b - 1); } impl_type span_; }; template <int = 0> using zstring_span = C; struct D { void m_fn5() const; }; void D::m_fn5() const { zstring_span<> c({0, 0}); try { c.m_fn4(); } catch (int) { } } markus@x4 tmp % g++ -c -O2 -Wall string_span_tests.ii string_span_tests.ii: In member function ‘void D::m_fn5() const’: string_span_tests.ii:14:29: warning: assuming signed overflow does not occur when assuming that (X - c) <= X is always true [-Wstrict-overflow] if (__builtin_expect(p1 <= a, 1)) ~~~^~~~