VC10 crashes when compiling the below code. Boost version is 1.53, visual studio version4.0.30319 SP1 Rel.template <typename T>struct ExecuteOnUnwindHelper{ ExecuteOnUnwindHelper(T _functor) : mFunctor(_functor) { } ~ExecuteOnUnwindHelper() { mFunctor(); } T mFunctor;};template <typename T>auto ExecuteOnUnwind(T _func) -> boost::shared_ptr<ExecuteOnUnwindHelper<decltype(boost::bind(_func))>>{ return boost::shared_ptr<ExecuteOnUnwindHelper<decltype(boost::bind(_func))>>(new ExecuteOnUnwindHelper<decltype(boost::bind(_func))>(boost::bind(_func)));}template <typename T, typename T2>auto ExecuteOnUnwind(T _func, T2 _arg1) -> boost::shared_ptr<ExecuteOnUnwindHelper<decltype(boost::bind(_func, _arg1))>>{ return boost::shared_ptr<ExecuteOnUnwindHelper<decltype(boost::bind(_func, _arg1))>>(new ExecuteOnUnwindHelper<decltype(boost::bind(_func, _arg1))>(boost::bind(_func, _arg1)));}template <typename T, typename T2, typename T3>auto ExecuteOnUnwind(T _func, T2 _arg1, T3 _arg2) -> boost::shared_ptr<ExecuteOnUnwindHelper<decltype(boost::bind(_func, _arg1, _arg2))>>{ return boost::shared_ptr<ExecuteOnUnwindHelper<decltype(boost::bind(_func, _arg1, _arg2))>>(new ExecuteOnUnwindHelper<decltype(boost::bind(_func, _arg1, _arg2))>(boost::bind(_func, _arg1, _arg2)));}template <typename T, typename T2, typename T3, typename T4>auto ExecuteOnUnwind(T _func, T2 _arg1, T3 _arg2, T4 _arg3) -> boost::shared_ptr<ExecuteOnUnwindHelper<decltype(boost::bind(_func, _arg1, _arg2, _arg3))>>{ return boost::shared_ptr<ExecuteOnUnwindHelper<decltype(boost::bind(_func, _arg1, _arg2, _arg3))>>(new ExecuteOnUnwindHelper<decltype(boost::bind(_func, _arg1, _arg2, _arg3))>(boost::bind(_func, _arg1, _arg2, _arg3)));}void func0(){wcout << L"cleanup 0" << endl;}void func1(int a){ wcout << L"cleanup 1" << endl;}void func2(int a, int b){ wcout << L"cleanup 2" << endl;}void func3(int a, int b, int c, int d){ wcout << L"cleanup 3" << endl;}void foo(){ int a = 5; auto eou0 = ExecuteOnUnwind(&func0); auto eou1 = ExecuteOnUnwind(&func1, a); auto eou2 = ExecuteOnUnwind(&func2, a, a); auto eou3 = ExecuteOnUnwind(&func3, a, a, a);}
Visual Studio/Team Foundation Server/.NET Framework Tooling Version
Steps to reproduce
Product Language
Operating System
Operating System Language
Actual results
Expected results