|
Boost Users : |
Subject: Re: [Boost-users] [Boost.Coroutine] Problem compiling simple code with c++98 compiler
From: Lukas Czaja (lukas70000_at_[hidden])
Date: 2013-03-27 19:04:35
2013/3/27 Lukas Czaja <lukas70000_at_[hidden]>:
> Hi,
> i was checking if my code is compatible with c++98 standard and i've
> encounterd compile error. With -std c++11 option everything works
> fine.
> Below i've written code causing same problem.
>
> #include <boost/coroutine/coroutine.hpp>
> #include <boost/coroutine/attributes.hpp>
>
> typedef boost::coroutines::coroutine<void( boost::system::error_code ,
> std::size_t)> coro_t;
>
> struct coro_test{
>
> coro_test() {}
>
> void coro_fun(typename coro_t::caller_type& ca)const{
> boost::system::error_code ec;
> boost::tie(ec, boost::tuples::ignore) = ca.get();
> ca();
> }
>
> coro_t coro;
> };
>
>
> int main(int argc, char *argv[])
> {
>
> {
> boost::system::error_code ec;
> coro_t coro2; //default construction is ok
> coro_test ctest; //compile error , why ???
> coro_t coro( boost::bind(&coro_test::coro_fun, &ctest,
> _1),coro_t::arguments( ec, 7));
> coro = coro_t(boost::bind(&coro_test::coro_fun, &ctest,
> _1),coro_t::arguments( ec, 7));
> }
> ...
>
> /usr/local/include/boost/type_traits/is_function.hpp:50: b³±d:forming
> pointer to reference type
> 'boost::rv<boost::coroutines::coroutine<void(boost::system::error_code,
> long unsigned int)> >&'
>
> /usr/local/include/boost/type_traits/is_function.hpp:102: b³±d:'value'
> is not a member of
> 'boost::detail::is_function_impl<boost::rv<boost::coroutines::coroutine<void(boost::system::error_code,
> long unsigned int)> >&>'
>
> /usr/local/include/boost/type_traits/is_convertible.hpp:354:
> b³±d:'value' is not a member of
> 'boost::is_function<boost::rv<boost::coroutines::coroutine<void(boost::system::error_code,
> long unsigned int)> >&>'
>
> /usr/local/include/boost/utility/enable_if.hpp:59: b³±d:'value' is not
> a member of 'boost::is_convertible<boost::coroutines::coroutine<void(boost::system::error_code,
> long unsigned int)>&,
> boost::rv<boost::coroutines::coroutine<void(boost::system::error_code,
> long unsigned int)> >&>'
>
>
> I work with Qt, g++ compiler on ubuntu 12.10
> Is this library bug ?
There is bug in code.
Problem is caused by generated default copy constructor.
I checked inherit boost::noncopyable before which cause same errors,
and I thought copy constructor is not a case. Sorry for that
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net