id summary reporter owner description type status milestone component version severity resolution keywords cc 12754 operator| overload for boost::range_details::replace_holder is not SFINAE friendly Tim Wynants Neil Groves "If I provide a simple operator | overload for my template class and I provide a class template specializations with for instance a boost range (so that adl adds the boost::range_details namespace for overloads) then the compiler chokes on the non-SFINEA friendly overload {{{ friendly boost::range_details::operator|( SinglePassRange, const replace_holder::type> ) }}} ---- Example: {{{ namespace local { template struct boo {}; // this overload is not prefered when T is a boost::range::xxx_range template auto operator|(boo, U) { return false; } void finds_local_operator_overload() { std::vector xs; // works like expected and calls local::operator| auto f = boo{} | xs; } void prefers_boost_range_detail_replaced_operator_overload_instead_of_local_operator() { std::vector xs; // compiler error because it tries to call 'boost::range_detail::operator|' auto filtered = xs | boost::adaptors::filtered([](auto &&x){ return x % 2; }); auto f = boo{} | xs; } } }}} clang error (msvc reports almost the same): {{{ /xxx/../../thirdparty/boost/1.60.0/dist/boost/range/value_type.hpp:26:70: error: no type named 'type' in 'boost::range_iterator > > >, void>' struct range_value : iterator_value< typename range_iterator::type > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~ /xxx/../../thirdparty/boost/1.60.0/dist/boost/range/adaptor/replaced.hpp:122:40: note: in instantiation of template class 'boost::range_value > > > >' requested here BOOST_DEDUCED_TYPENAME range_value::type>& f) ^ /xxx/Tests.cpp:222:37: note: while substituting deduced template arguments into function template 'operator|' [with SinglePassRange = local::boo > > >] auto f = boo{} | xs; }}} This can be easily prevented by making the operator overload SFINEA friendly. " Bugs new To Be Determined range Boost 1.61.0 Problem SFINAE, ADL, range