Boost logo

Boost :

From: Daniel James (daniel_at_[hidden])
Date: 2004-11-13 18:03:32


named_params_test.cpp isn't working for me on g++ 3.3.3/3.4.1 on linux.
I get the following error:

/home/daniel/projects/boost/boost/mpl/eval_if.hpp: In instantiation of
`boost::mpl::eval_if<boost::detail::is_const_reference_wrapper<const
boost::reference_wrapper<int> >, const boost::reference_wrapper<int>,
boost::mpl::identity<const boost::reference_wrapper<int> > >':
/home/daniel/src/boost/boost/named_params.hpp:431: instantiated from
`boost::detail::unwrap_cv_reference<const boost::reference_wrapper<int> >'
named_params_test.cpp:159: instantiated from here
/home/daniel/projects/boost/boost/mpl/eval_if.hpp:33: error: base
`boost::reference_wrapper<int>' with only non-default constructor in
class without a constructor

The problem seems to be that eval_if inherits from
boost::reference_wrapper<int> which doesn't have a default constructor.
Is this a bug in g++? Since eval_if is never constructed I guess it
might be?

The following patch seems to work.

Daniel

diff -ru boost/boost/named_params.hpp boost-new/boost/named_params.hpp
--- boost/boost/named_params.hpp 2004-11-08 01:20:28.000000000 +0000
+++ boost-new/boost/named_params.hpp 2004-11-13 22:47:07.000000000 +0000
@@ -424,11 +424,11 @@
    template <class T>
    struct unwrap_cv_reference
    {
- typedef typename mpl::eval_if<
+ typedef typename mpl::if_<
            is_const_reference_wrapper<T>
          , T
          , mpl::identity<T>
- >::type type;
+ >::type::type type;
    };

  } // namespace detail


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk