Recently updated to Boost 1.86 and VS2022 (x64) and we get a weird compilation error:
#include <boost/bind/apply.hpp> // comment this out to get success
#include <boost/bind/bind.hpp>
#include <boost/function.hpp>
int TestArg(int, double)
{
return 0;
}
void f()
{
boost::function<int (int)> fn = boost::bind(&TestArg, boost::placeholders::_1, 1.0);
}
Error:
1>D:\Work Sdk\boost_1_86_0\boost\function\function_template.hpp(926,35): error C2977: 'boost::apply': too many template arguments
1>(compiling source file 'Boost.cpp')
1> D:\Work Sdk\boost_1_86_0\boost\bind\apply.hpp(17,26):
1> see declaration of 'boost::apply'
1> D:\Work Sdk\boost_1_86_0\boost\function\function_template.hpp(926,35):
1> the template instantiation context (the oldest one first) is
1> D:\Work\Src\Temp\Bla\Boost.cpp(13,34):
1> see reference to function template instantiation 'boost::function<int (int)>::function<boost::_bi::bind_t<int,int (__cdecl *)(int,double),boost::_bi::list<boost::arg<1>,boost::_bi::value>>>(Functor,int)' being compiled
1> with
1> [
1> T=double,
1> Functor=boost::_bi::bind_t<int,int (__cdecl *)(int,double),boost::_bi::list<boost::arg<1>,boost::_bi::value>>
1> ]
1> D:\Work\Src\Temp\Bla\Boost.cpp(13,34):
1> see the first reference to 'boost::function<int (int)>::function' in 'f'
1> D:\Work Sdk\boost_1_86_0\boost\function\function_template.hpp(1084,24):
1> see reference to function template instantiation 'boost::function_n<R,int>::function_n<boost::_bi::bind_t<R,int (__cdecl *)(int,double),boost::_bi::list<boost::arg<1>,boost::_bi::value>>>(Functor,int)' being compiled
1> with
1> [
1> R=int,
1> T=double,
1> Functor=boost::_bi::bind_t<int,int (__cdecl *)(int,double),boost::_bi::list<boost::arg<1>,boost::_bi::value>>
1> ]
1> D:\Work Sdk\boost_1_86_0\boost\function\function_template.hpp(757,13):
1> see reference to function template instantiation 'void boost::function_n<R,int>::assign_to<boost::_bi::bind_t<R,int (__cdecl *)(int,double),boost::_bi::list<boost::arg<1>,boost::_bi::value>>>(Functor)' being compiled
1> with
1> [
1> R=int,
1> T=double,
1> Functor=boost::_bi::bind_t<int,int (__cdecl *)(int,double),boost::_bi::list<boost::arg<1>,boost::_bi::value>>
1> ]
If one comments out the <boost/bind/apply.hpp>it compiles fine. Using auto or std::function also works.
Recently updated to Boost 1.86 and VS2022 (x64) and we get a weird compilation error:
Error:
1>D:\Work Sdk\boost_1_86_0\boost\function\function_template.hpp(926,35): error C2977: 'boost::apply': too many template arguments
1>(compiling source file 'Boost.cpp')
1> D:\Work Sdk\boost_1_86_0\boost\bind\apply.hpp(17,26):
1> see declaration of 'boost::apply'
1> D:\Work Sdk\boost_1_86_0\boost\function\function_template.hpp(926,35):
1> the template instantiation context (the oldest one first) is
1> D:\Work\Src\Temp\Bla\Boost.cpp(13,34):
1> see reference to function template instantiation 'boost::function<int (int)>::function<boost::_bi::bind_t<int,int (__cdecl *)(int,double),boost::_bi::list<boost::arg<1>,boost::_bi::value>>>(Functor,int)' being compiled
1> with
1> [
1> T=double,
1> Functor=boost::_bi::bind_t<int,int (__cdecl *)(int,double),boost::_bi::list<boost::arg<1>,boost::_bi::value>>
1> ]
1> D:\Work\Src\Temp\Bla\Boost.cpp(13,34):
1> see the first reference to 'boost::function<int (int)>::function' in 'f'
1> D:\Work Sdk\boost_1_86_0\boost\function\function_template.hpp(1084,24):
1> see reference to function template instantiation 'boost::function_n<R,int>::function_n<boost::_bi::bind_t<R,int (__cdecl *)(int,double),boost::_bi::list<boost::arg<1>,boost::_bi::value>>>(Functor,int)' being compiled
1> with
1> [
1> R=int,
1> T=double,
1> Functor=boost::_bi::bind_t<int,int (__cdecl *)(int,double),boost::_bi::list<boost::arg<1>,boost::_bi::value>>
1> ]
1> D:\Work Sdk\boost_1_86_0\boost\function\function_template.hpp(757,13):
1> see reference to function template instantiation 'void boost::function_n<R,int>::assign_to<boost::_bi::bind_t<R,int (__cdecl *)(int,double),boost::_bi::list<boost::arg<1>,boost::_bi::value>>>(Functor)' being compiled
1> with
1> [
1> R=int,
1> T=double,
1> Functor=boost::_bi::bind_t<int,int (__cdecl *)(int,double),boost::_bi::list<boost::arg<1>,boost::_bi::value>>
1> ]
If one comments out the <boost/bind/apply.hpp>it compiles fine. Using auto or std::function also works.