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?
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
participants (2)
-
Sergei Politov
-
Steven Watanabe