boostorg / proto

Boost.org proto module
http://boost.org/libs/proto
21 stars 38 forks source link

Fix -Wdeprecated-copy follow-up #26

Closed Kojoley closed 4 years ago

Kojoley commented 4 years ago

This one did not show up in Proto tests, but in Spirit.

ericniebler commented 4 years ago

Can you give me a little more context about what motivates this change?

Kojoley commented 4 years ago

https://wandbox.org/permlink/6HE9kgFvucFCEjEG

boost/proto/extends.hpp:544:13: warning: definition of implicit copy assignment operator for 'extends<boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::spirit::qi::reference<const boost::spirit::repository::qi::subrule<0, boost::spirit::unused_type, boost::spirit::unused_type>>>, 0>, boost::spirit::repository::qi::subrule<0, boost::spirit::unused_type, boost::spirit::unused_type>, boost::proto::domainns_::default_domain, 0>' is deprecated because it has a user-declared copy constructor [-Wdeprecated-copy]
            extends(extends const &that)
            ^
Kojoley commented 4 years ago

Based on proto/test/mpl.cpp repro:

#include <boost/proto/proto.hpp>

namespace proto = boost::proto;

template<class E>
struct my_expr
  : proto::extends<E, my_expr<E> >
{
    my_expr(E const &e = E())
      : proto::extends<E, my_expr<E>>(e)
    {}
};

int main()
{
    my_expr<proto::terminal<int>::type> i;
    i = i;
}

https://wandbox.org/permlink/NgDtn7Shq1H0SFuz

Kojoley commented 4 years ago

Ping