// { dg-do compile { target c++11 } } #include // Custom allocator defined with std::allocator, but doesn't provide rebind. template struct Alloc : std::allocator { }; std::vector> v; // { dg-error "here" "" { target c++17_down } } // Custom allocator that does provide rebind, but incorrectly. template struct Alloc2 { using value_type = T; template struct rebind { using other = Alloc; }; // not Alloc2 T* allocate(std::size_t n) { return std::allocator().allocate(n); } void deallocate(T* p, std::size_t n) { std::allocator().deallocate(p, n); } }; std::vector> v2; // { dg-error "here" } // { dg-error "static assertion failed: .*rebind_alloc" "" { target *-*-* } 0 }