https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72793
Bug ID: 72793 Summary: pointer_traits is too strict about rebinding Product: gcc Version: 6.1.1 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- #include <memory> template<typename T, int = 0> struct Ptr { using element_type = T; }; std::pointer_traits<Ptr<int>>::element_type e; /home/jwakely/gcc/7/include/c++/7.0.0/bits/ptr_traits.h: In instantiation of ‘struct std::pointer_traits<Ptr<int> >’: alloc.cc:8:30: required from here /home/jwakely/gcc/7/include/c++/7.0.0/bits/ptr_traits.h:113:7: error: static assertion failed: pointer type defines rebind<U> or is like SomePointer<T, Args> static_assert(!is_same<rebind<element_type>, __undefined>::value, ^~~~~~~~~~~~~ The standard says that the instantiation of pointer_traits<Ptr<T, int>>::rebind should be ill-formed, but the assertion fires even when it isn't instantiated.