[Boost-bugs] [Boost C++ Libraries] #12249: Wrong operator|() overload being found on multiple platforms & causing compilation failure

Subject: [Boost-bugs] [Boost C++ Libraries] #12249: Wrong operator|() overload being found on multiple platforms & causing compilation failure
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-06-02 15:47:39


#12249: Wrong operator|() overload being found on multiple platforms & causing
compilation failure
------------------------------+------------------------
 Reporter: rob.desbois@… | Owner: neilgroves
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: range
  Version: Boost 1.61.0 | Severity: Problem
 Keywords: |
------------------------------+------------------------
 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.

 I can reproduce this with filtered, transformed and indexed adaptors; on
 Clang, gcc & MSVC; and with Boost 1.57 and 1.61.

 The minimal failing testcase is attached, and compiles fine when the
 replaced.hpp include is commented out.

 The error I get with clang for the attached file is:
 {{{
 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<Base>'
 requested here
         class replace_holder : public holder2<T>
                                       ^
 invoke-boost-failure.cpp:17:33: note: in instantiation of template class
 'boost::range_detail::replace_holder<Base>' requested here
     for (const auto& 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.
 }}}


 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.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12249>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC