Boost logo

Boost Users :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-04-15 16:56:25


AMDG

Sergei Politov wrote:
> The following example:
> ==============================================
> #include <boost/function.hpp>
> #include <boost/spirit/phoenix.hpp>
>
> int main()
> {
> boost::function<void()> f;
> phoenix::bind(f);
> }
> ==============================================
>
> Produces compilation warning on MSVC 9.0:
> C:\work\cpp\bind.cpp : warning C4717:
> 'phoenix::functor_action<boost::function<void
> __cdecl(void),std::allocator<void> > >::functor_action<boost::function<void
> __cdecl(void),std::allocator<void> > >' : recursive on all control paths,
> function will cause runtime stack overflow
>
> And stack overflow in runtime.
>
> What is wrong in this example?
>

The compiler is wrong...
Add the following line to functor_action in boost/spirit/phoenix/binders.hpp
    functor_action(const functor_action& other) :
FuncT(static_cast<const FuncT&>(other)) {}

In Christ,
Steven Watanabe


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