https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115939
--- Comment #6 from Jiang An <de34 at live dot cn> --- I found that we may also need to add some operator- overloads (https://godbolt.org/z/jTTcYhxMc). All standard library implementations are currently broken. ``` #include <cstddef> #include <vector> #include <array> #include <deque> struct any_convertible_subtractable { any_convertible_subtractable() = default; template<class T> any_convertible_subtractable(T&&) {} template<class T> friend std::ptrdiff_t operator-(any_convertible_subtractable, T&&) { return 0; } template<class T> friend std::ptrdiff_t operator-(T&&, any_convertible_subtractable) { return 0; } }; template<class Cont> void test_container(Cont&& c) { (void)(c.end() - c.begin()); } int main() { test_container(std::vector<any_convertible_subtractable>{}); test_container(std::array<any_convertible_subtractable, 1>{}); test_container(std::deque<any_convertible_subtractable>{}); } ```