Boost C++ Libraries: Ticket #12249: Wrong operator|() overload being found on multiple platforms & causing compilation failure https://svn.boost.org/trac10/ticket/12249 <p> When using the pipe syntax (operator| overloads) for range adaptors I'm finding that the overloads taking replace_holder are being incorrectly selected when using other adaptors over a range exposing abstract base class references. </p> <p> I can reproduce this with filtered, transformed and indexed adaptors; on Clang, gcc &amp; MSVC; and with Boost 1.57 and 1.61. </p> <p> The minimal failing testcase is attached, and compiles fine when the replaced.hpp include is commented out. </p> <p> The error I get with clang for the attached file is: </p> <pre class="wiki">In file included from invoke-boost-failure.cpp:1: In file included from /usr/include/boost/range/adaptor/indexed.hpp:23: /usr/include/boost/range/adaptor/argument_fwd.hpp:36:15: error: field type 'Base' is an abstract class T val1, val2; ^ /usr/include/boost/range/adaptor/replaced.hpp:93:39: note: in instantiation of template class 'boost::range_detail::holder2&lt;Base&gt;' requested here class replace_holder : public holder2&lt;T&gt; ^ invoke-boost-failure.cpp:17:33: note: in instantiation of template class 'boost::range_detail::replace_holder&lt;Base&gt;' requested here for (const auto&amp; b : refs | boost::adaptors::indexed()) ^ invoke-boost-failure.cpp:8:13: note: unimplemented pure virtual method '~Base' in 'Base' virtual ~Base() = 0; ^ In file included from invoke-boost-failure.cpp:1: In file included from /usr/include/boost/range/adaptor/indexed.hpp:23: /usr/include/boost/range/adaptor/argument_fwd.hpp:36:21: error: field type 'Base' is an abstract class T val1, val2; ^ 2 errors generated. </pre><p> I can work around this by using the function call syntax for adaptors, but I can't suggest a fix as I don't understand why that overload is being selected at all. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12249 Trac 1.4.3 rob.desbois@… Thu, 02 Jun 2016 15:48:11 GMT attachment set https://svn.boost.org/trac10/ticket/12249 https://svn.boost.org/trac10/ticket/12249 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">invoke-boost-failure.cpp</span> </li> </ul> <p> Minimal failing test case </p> Ticket Michel Morin Thu, 02 Jun 2016 18:21:00 GMT <link>https://svn.boost.org/trac10/ticket/12249#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12249#comment:1</guid> <description> <p> During the overload resolution of operator <code>|</code>, the operator for <code>replaced_range</code> is instantiated if <code>replaced.hpp</code> is included and the associated namespaces contain <code>boost::range_detail</code>. This instantiation results in a hard error, if the range's value type is an abstract type. </p> <p> This problem can be fixed by adding SFINAE-based constraints to operator <code>|</code> for <code>replaced_range</code> so that the range's value type is not an abstract type. </p> </description> <category>Ticket</category> </item> </channel> </rss>