I tested the code in linux g++ (GCC) 8.2.0, g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, and all of them can be compiled, but it fails to compile in g++ (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0. Does anyone know why? I have a feeling that there are no errors in this code:
#include <functional>
#include <iostream>
#include <any>
#include <queue>
class Foo
{
public:
void test(std::any a)
{
int val = std::any_cast<int>(a);
std::cout << val << std::endl;
}
};
using FUNC = void(Foo::*)(std::any);
std::queue<std::function<void(void)>> queue;
void enquee(Foo* foo, FUNC f, std::any a)
{
queue.push(std::bind(f, foo, a));
queue.front()();
queue.pop();
}
int main(void)
{
std::any a = 1;
Foo f;
enquee(&f, &Foo::test, a);
}
Confusing error message in 9.4.0
usr/include/c++/9/type_traits: In instantiation of 'struct std::__and_<std::is_copy_constructible<std::_Tuple_impl<1, std::any> >, std::is_constructible<std::_Tuple_impl<1, std::any>, const std::_Tuple_impl<1, std::any>&> >':
/usr/include/c++/9/any:181:58: required by substitution of 'template<class _ValueType, class _Tp, class _Mgr, typename std::enable_if<std::__and_<std::is_copy_constructible<_Tp>, std::is_constructible<_Tp, _ValueType&&> >::value, bool>::type <anonymous>, typename std::enable_if<(! std::__is_in_place_type<_Tp>::value), bool>::type <anonymous> > std::any::any(_ValueType&&) [with _ValueType = const std::_Tuple_impl<1, std::any>&; _Tp = std::_Tuple_impl<1, std::any>; _Mgr = std::any::_Manager_external<std::_Tuple_impl<1, std::any> >; typename std::enable_if<std::__and_<std::is_copy_constructible<_Tp>, std::is_constructible<_Tp, _ValueType&&> >::value, bool>::type <anonymous> = <missing>; typename std::enable_if<(! std::__is_in_place_type<_Tp>::value), bool>::type <anonymous> = <missing>]'
/usr/include/c++/9/type_traits:883:12: required from 'struct std::is_constructible<std::_Tuple_impl<1, std::any>, const std::_Tuple_impl<1, std::any>&>'
/usr/include/c++/9/type_traits:901:12: required from 'struct std::__is_copy_constructible_impl<std::_Tuple_impl<1, std::any>, true>'
/usr/include/c++/9/type_traits:907:12: required from 'struct std::is_copy_constructible<std::_Tuple_impl<1, std::any> >'
/usr/include/c++/9/type_traits:131:12: [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/include/c++/9/tuple:231:42: required from 'constexpr std::_Tuple_impl<_Idx, _Head, _Tail ...>::_Tuple_impl(std::_Tuple_impl<_Idx, _Head, _Tail ...>&&) [with long unsigned int _Idx = 0; _Head = Foo*; _Tail = {std::any}]'
/usr/include/c++/9/tuple:983:17: required from 'std::_Bind<_Functor(_Bound_args ...)>::_Bind(std::_Bind<_Functor(_Bound_args ...)>&&) [with _Functor = void (Foo::*)(std::any); _Bound_args = {Foo*, std::any}]'
/usr/include/c++/9/bits/std_function.h:252:39: required from 'static void std::_Function_base::_Base_manager<_Functor>::_M_init_functor(std::_Any_data&, _Functor&&, std::false_type) [with _Functor = std::_Bind<void (Foo::*(Foo*, std::any))(std::any)>; std::false_type = std::integral_constant<bool, false>]'
/usr/include/c++/9/bits/std_function.h:223:19: required from 'static void std::_Function_base::_Base_manager<_Functor>::_M_init_functor(std::_Any_data&, _Functor&&) [with _Functor = std::_Bind<void (Foo::*(Foo*, std::any))(std::any)>]'
/usr/include/c++/9/bits/std_function.h:675:34: required from 'std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = std::_Bind<void (Foo::*(Foo*, std::any))(std::any)>; <template-parameter-2-2> = void; <template-parameter-2-3> = void; _Res = void; _ArgTypes = {}]'
kesan.cpp:22:40: required from here
/usr/include/c++/9/type_traits:131:12: error: incomplete type 'std::is_copy_constructible<std::_Tuple_impl<1, std::any> >' used in nested name specifier
131 | struct __and_<_B1, _B2>
| ^~~~~~~~~~~~~~~~
/usr/include/c++/9/type_traits: In instantiation of 'struct std::__and_<std::is_copy_constructible<std::_Tuple_impl<1, std::any> >, std::__not_<std::is_constructible<std::_Tuple_impl<1, std::any>, const std::_Tuple_impl<1, std::any>&> >, std::__not_<std::__is_in_place_type<std::_Tuple_impl<1, std::any> > > >':
/usr/include/c++/9/type_traits:150:27: required from 'constexpr const bool std::__and_v<std::is_copy_constructible<std::_Tuple_impl<1, std::any> >, std::__not_<std::is_constructible<std::_Tuple_impl<1, std::any>, const std::_Tuple_impl<1, std::any>&> >, std::__not_<std::__is_in_place_type<std::_Tuple_impl<1, std::any> > > >'
/usr/include/c++/9/any:192:27: required by substitution of 'template<class _ValueType, class _Tp, class _Mgr, typename std::enable_if<__and_v<std::is_copy_constructible<_Tp>, std::__not_<std::is_constructible<_Tp, _ValueType&&> >, std::__not_<std::__is_in_place_type<_Tp> > >, bool>::type <anonymous> > std::any::any(_ValueType&&) [with _ValueType = const std::_Tuple_impl<1, std::any>&; _Tp = std::_Tuple_impl<1, std::any>; _Mgr = std::any::_Manager_external<std::_Tuple_impl<1, std::any> >; typename std::enable_if<__and_v<std::is_copy_constructible<_Tp>, std::__not_<std::is_constructible<_Tp, _ValueType&&> >, std::__not_<std::__is_in_place_type<_Tp> > >, bool>::type <anonymous> = <missing>]'
/usr/include/c++/9/type_traits:883:12: required from 'struct std::is_constructible<std::_Tuple_impl<1, std::any>, const std::_Tuple_impl<1, std::any>&>'
/usr/include/c++/9/type_traits:901:12: required from 'struct std::__is_copy_constructible_impl<std::_Tuple_impl<1, std::any>, true>'
/usr/include/c++/9/type_traits:907:12: required from 'struct std::is_copy_constructible<std::_Tuple_impl<1, std::any> >'
/usr/include/c++/9/type_traits:131:12: [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/include/c++/9/tuple:231:42: required from 'constexpr std::_Tuple_impl<_Idx, _Head, _Tail ...>::_Tuple_impl(std::_Tuple_impl<_Idx, _Head, _Tail ...>&&) [with long unsigned int _Idx = 0; _Head = Foo*; _Tail = {std::any}]'
/usr/include/c++/9/tuple:983:17: required from 'std::_Bind<_Functor(_Bound_args ...)>::_Bind(std::_Bind<_Functor(_Bound_args ...)>&&) [with _Functor = void (Foo::*)(std::any); _Bound_args = {Foo*, std::any}]'
/usr/include/c++/9/bits/std_function.h:252:39: required from 'static void std::_Function_base::_Base_manager<_Functor>::_M_init_functor(std::_Any_data&, _Functor&&, std::false_type) [with _Functor = std::_Bind<void (Foo::*(Foo*, std::any))(std::any)>; std::false_type = std::integral_constant<bool, false>]'
/usr/include/c++/9/bits/std_function.h:223:19: required from 'static void std::_Function_base::_Base_manager<_Functor>::_M_init_functor(std::_Any_data&, _Functor&&) [with _Functor = std::_Bind<void (Foo::*(Foo*, std::any))(std::any)>]'
/usr/include/c++/9/bits/std_function.h:675:34: required from 'std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = std::_Bind<void (Foo::*(Foo*, std::any))(std::any)>; <template-parameter-2-2> = void; <template-parameter-2-3> = void; _Res = void; _ArgTypes = {}]'
kesan.cpp:22:40: required from here
/usr/include/c++/9/type_traits:136:12: error: incomplete type 'std::is_copy_constructible<std::_Tuple_impl<1, std::any> >' used in nested name specifier
136 | struct __and_<_B1, _B2, _B3, _Bn...>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/9/type_traits: In instantiation of 'constexpr const bool std::__and_v<std::is_copy_constructible<std::_Tuple_impl<1, std::any> >, std::__not_<std::is_constructible<std::_Tuple_impl<1, std::any>, const std::_Tuple_impl<1, std::any>&> >, std::__not_<std::__is_in_place_type<std::_Tuple_impl<1, std::any> > > >':
/usr/include/c++/9/any:192:27: required by substitution of 'template<class _ValueType, class _Tp, class _Mgr, typename std::enable_if<__and_v<std::is_copy_constructible<_Tp>, std::__not_<std::is_constructible<_Tp, _ValueType&&> >, std::__not_<std::__is_in_place_type<_Tp> > >, bool>::type <anonymous> > std::any::any(_ValueType&&) [with _ValueType = const std::_Tuple_impl<1, std::any>&; _Tp = std::_Tuple_impl<1, std::any>; _Mgr = std::any::_Manager_external<std::_Tuple_impl<1, std::any> >; typename std::enable_if<__and_v<std::is_copy_constructible<_Tp>, std::__not_<std::is_constructible<_Tp, _ValueType&&> >, std::__not_<std::__is_in_place_type<_Tp> > >, bool>::type <anonymous> = <missing>]'
/usr/include/c++/9/type_traits:883:12: required from 'struct std::is_constructible<std::_Tuple_impl<1, std::any>, const std::_Tuple_impl<1, std::any>&>'
/usr/include/c++/9/type_traits:901:12: required from 'struct std::__is_copy_constructible_impl<std::_Tuple_impl<1, std::any>, true>'
/usr/include/c++/9/type_traits:907:12: required from 'struct std::is_copy_constructible<std::_Tuple_impl<1, std::any> >'
/usr/include/c++/9/type_traits:131:12: [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/include/c++/9/tuple:231:42: required from 'constexpr std::_Tuple_impl<_Idx, _Head, _Tail ...>::_Tuple_impl(std::_Tuple_impl<_Idx, _Head, _Tail ...>&&) [with long unsigned int _Idx = 0; _Head = Foo*; _Tail = {std::any}]'
/usr/include/c++/9/tuple:983:17: required from 'std::_Bind<_Functor(_Bound_args ...)>::_Bind(std::_Bind<_Functor(_Bound_args ...)>&&) [with _Functor = void (Foo::*)(std::any); _Bound_args = {Foo*, std::any}]'
/usr/include/c++/9/bits/std_function.h:252:39: required from 'static void std::_Function_base::_Base_manager<_Functor>::_M_init_functor(std::_Any_data&, _Functor&&, std::false_type) [with _Functor = std::_Bind<void (Foo::*(Foo*, std::any))(std::any)>; std::false_type = std::integral_constant<bool, false>]'
/usr/include/c++/9/bits/std_function.h:223:19: required from 'static void std::_Function_base::_Base_manager<_Functor>::_M_init_functor(std::_Any_data&, _Functor&&) [with _Functor = std::_Bind<void (Foo::*(Foo*, std::any))(std::any)>]'
/usr/include/c++/9/bits/std_function.h:675:34: required from 'std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = std::_Bind<void (Foo::*(Foo*, std::any))(std::any)>; <template-parameter-2-2> = void; <template-parameter-2-3> = void; _Res = void; _ArgTypes = {}]'
kesan.cpp:22:40: required from here
/usr/include/c++/9/type_traits:150:27: error: 'value' is not a member of 'std::__and_<std::is_copy_constructible<std::_Tuple_impl<1, std::any> >, std::__not_<std::is_constructible<std::_Tuple_impl<1, std::any>, const std::_Tuple_impl<1, std::any>&> >, std::__not_<std::__is_in_place_type<std::_Tuple_impl<1, std::any> > > >'
150 | inline constexpr bool __and_v = __and_<_Bn...>::value;
| ^~~~~~~
/usr/include/c++/9/type_traits: In instantiation of 'struct std::__not_<std::is_constructible<std::_Tuple_impl<1, std::any>, std::_Tuple_impl<1, std::any>&&> >':
/usr/include/c++/9/type_traits:131:12: required from 'struct std::__and_<std::__not_<std::is_constructible<std::_Tuple_impl<1, std::any>, std::_Tuple_impl<1, std::any>&&> >, std::__not_<std::__is_in_place_type<std::_Tuple_impl<1, std::any> > > >'
/usr/include/c++/9/type_traits:136:12: required from 'struct std::__and_<std::is_copy_constructible<std::_Tuple_impl<1, std::any> >, std::__not_<std::is_constructible<std::_Tuple_impl<1, std::any>, std::_Tuple_impl<1, std::any>&&> >, std::__not_<std::__is_in_place_type<std::_Tuple_impl<1, std::any> > > >'
/usr/include/c++/9/type_traits:150:27: required from 'constexpr const bool std::__and_v<std::is_copy_constructible<std::_Tuple_impl<1, std::any> >, std::__not_<std::is_constructible<std::_Tuple_impl<1, std::any>, std::_Tuple_impl<1, std::any>&&> >, std::__not_<std::__is_in_place_type<std::_Tuple_impl<1, std::any> > > >'
/usr/include/c++/9/any:192:27: required by substitution of 'template<class _ValueType, class _Tp, class _Mgr, typename std::enable_if<__and_v<std::is_copy_constructible<_Tp>, std::__not_<std::is_constructible<_Tp, _ValueType&&> >, std::__not_<std::__is_in_place_type<_Tp> > >, bool>::type <anonymous> > std::any::any(_ValueType&&) [with _ValueType = std::_Tuple_impl<1, std::any>; _Tp = std::_Tuple_impl<1, std::any>; _Mgr = std::any::_Manager_external<std::_Tuple_impl<1, std::any> >; typename std::enable_if<__and_v<std::is_copy_constructible<_Tp>, std::__not_<std::is_constructible<_Tp, _ValueType&&> >, std::__not_<std::__is_in_place_type<_Tp> > >, bool>::type <anonymous> = <missing>]'
/usr/include/c++/9/type_traits:883:12: required from 'struct std::is_constructible<std::_Tuple_impl<1, std::any>, std::_Tuple_impl<1, std::any>&&>'
/usr/include/c++/9/type_traits:131:12: [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/include/c++/9/tuple:231:42: required from 'constexpr std::_Tuple_impl<_Idx, _Head, _Tail ...>::_Tuple_impl(std::_Tuple_impl<_Idx, _Head, _Tail ...>&&) [with long unsigned int _Idx = 0; _Head = Foo*; _Tail = {std::any}]'
/usr/include/c++/9/tuple:983:17: required from 'std::_Bind<_Functor(_Bound_args ...)>::_Bind(std::_Bind<_Functor(_Bound_args ...)>&&) [with _Functor = void (Foo::*)(std::any); _Bound_args = {Foo*, std::any}]'
/usr/include/c++/9/bits/std_function.h:252:39: required from 'static void std::_Function_base::_Base_manager<_Functor>::_M_init_functor(std::_Any_data&, _Functor&&, std::false_type) [with _Functor = std::_Bind<void (Foo::*(Foo*, std::any))(std::any)>; std::false_type = std::integral_constant<bool, false>]'
/usr/include/c++/9/bits/std_function.h:223:19: required from 'static void std::_Function_base::_Base_manager<_Functor>::_M_init_functor(std::_Any_data&, _Functor&&) [with _Functor = std::_Bind<void (Foo::*(Foo*, std::any))(std::any)>]'
/usr/include/c++/9/bits/std_function.h:675:34: required from 'std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = std::_Bind<void (Foo::*(Foo*, std::any))(std::any)>; <template-parameter-2-2> = void; <template-parameter-2-3> = void; _Res = void; _ArgTypes = {}]'
kesan.cpp:22:40: required from here
/usr/include/c++/9/type_traits:142:31: error: incomplete type 'std::is_constructible<std::_Tuple_impl<1, std::any>, std::_Tuple_impl<1, std::any>&&>' used in nested name specifier
142 | : public __bool_constant<!bool(_Pp::value)>
| ^~~~~~~~~~~~~~~~
/usr/include/c++/9/type_traits: In instantiation of 'struct std::__and_<std::__not_<std::is_constructible<std::_Tuple_impl<1, std::any>, std::_Tuple_impl<1, std::any>&&> >, std::__not_<std::__is_in_place_type<std::_Tuple_impl<1, std::any> > > >':
/usr/include/c++/9/type_traits:136:12: required from 'struct std::__and_<std::is_copy_constructible<std::_Tuple_impl<1, std::any> >, std::__not_<std::is_constructible<std::_Tuple_impl<1, std::any>, std::_Tuple_impl<1, std::any>&&> >, std::__not_<std::__is_in_place_type<std::_Tuple_impl<1, std::any> > > >'
/usr/include/c++/9/type_traits:150:27: required from 'constexpr const bool std::__and_v<std::is_copy_constructible<std::_Tuple_impl<1, std::any> >, std::__not_<std::is_constructible<std::_Tuple_impl<1, std::any>, std::_Tuple_impl<1, std::any>&&> >, std::__not_<std::__is_in_place_type<std::_Tuple_impl<1, std::any> > > >'
/usr/include/c++/9/any:192:27: required by substitution of 'template<class _ValueType, class _Tp, class _Mgr, typename std::enable_if<__and_v<std::is_copy_constructible<_Tp>, std::__not_<std::is_constructible<_Tp, _ValueType&&> >, std::__not_<std::__is_in_place_type<_Tp> > >, bool>::type <anonymous> > std::any::any(_ValueType&&) [with _ValueType = std::_Tuple_impl<1, std::any>; _Tp = std::_Tuple_impl<1, std::any>; _Mgr = std::any::_Manager_external<std::_Tuple_impl<1, std::any> >; typename std::enable_if<__and_v<std::is_copy_constructible<_Tp>, std::__not_<std::is_constructible<_Tp, _ValueType&&> >, std::__not_<std::__is_in_place_type<_Tp> > >, bool>::type <anonymous> = <missing>]'
/usr/include/c++/9/type_traits:883:12: required from 'struct std::is_constructible<std::_Tuple_impl<1, std::any>, std::_Tuple_impl<1, std::any>&&>'
/usr/include/c++/9/type_traits:131:12: [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/include/c++/9/tuple:231:42: required from 'constexpr std::_Tuple_impl<_Idx, _Head, _Tail ...>::_Tuple_impl(std::_Tuple_impl<_Idx, _Head, _Tail ...>&&) [with long unsigned int _Idx = 0; _Head = Foo*; _Tail = {std::any}]'
/usr/include/c++/9/tuple:983:17: required from 'std::_Bind<_Functor(_Bound_args ...)>::_Bind(std::_Bind<_Functor(_Bound_args ...)>&&) [with _Functor = void (Foo::*)(std::any); _Bound_args = {Foo*, std::any}]'
/usr/include/c++/9/bits/std_function.h:252:39: required from 'static void std::_Function_base::_Base_manager<_Functor>::_M_init_functor(std::_Any_data&, _Functor&&, std::false_type) [with _Functor = std::_Bind<void (Foo::*(Foo*, std::any))(std::any)>; std::false_type = std::integral_constant<bool, false>]'
/usr/include/c++/9/bits/std_function.h:223:19: required from 'static void std::_Function_base::_Base_manager<_Functor>::_M_init_functor(std::_Any_data&, _Functor&&) [with _Functor = std::_Bind<void (Foo::*(Foo*, std::any))(std::any)>]'
/usr/include/c++/9/bits/std_function.h:675:34: required from 'std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = std::_Bind<void (Foo::*(Foo*, std::any))(std::any)>; <template-parameter-2-2> = void; <template-parameter-2-3> = void; _Res = void; _ArgTypes = {}]'
kesan.cpp:22:40: required from here
/usr/include/c++/9/type_traits:131:12: error: 'value' is not a member of 'std::__not_<std::is_constructible<std::_Tuple_impl<1, std::any>, std::_Tuple_impl<1, std::any>&&> >'
131 | struct __and_<_B1, _B2>
| ^~~~~~~~~~~~~~~~
/usr/include/c++/9/type_traits: In instantiation of 'constexpr const bool std::__and_v<std::is_copy_constructible<std::_Tuple_impl<1, std::any> >, std::__not_<std::is_constructible<std::_Tuple_impl<1, std::any>, std::_Tuple_impl<1, std::any>&&> >, std::__not_<std::__is_in_place_type<std::_Tuple_impl<1, std::any> > > >':
/usr/include/c++/9/any:192:27: required by substitution of 'template<class _ValueType, class _Tp, class _Mgr, typename std::enable_if<__and_v<std::is_copy_constructible<_Tp>, std::__not_<std::is_constructible<_Tp, _ValueType&&> >, std::__not_<std::__is_in_place_type<_Tp> > >, bool>::type <anonymous> > std::any::any(_ValueType&&) [with _ValueType = std::_Tuple_impl<1, std::any>; _Tp = std::_Tuple_impl<1, std::any>; _Mgr = std::any::_Manager_external<std::_Tuple_impl<1, std::any> >; typename std::enable_if<__and_v<std::is_copy_constructible<_Tp>, std::__not_<std::is_constructible<_Tp, _ValueType&&> >, std::__not_<std::__is_in_place_type<_Tp> > >, bool>::type <anonymous> = <missing>]'
/usr/include/c++/9/type_traits:883:12: required from 'struct std::is_constructible<std::_Tuple_impl<1, std::any>, std::_Tuple_impl<1, std::any>&&>'
/usr/include/c++/9/type_traits:131:12: required from 'struct std::__and_<std::is_copy_constructible<std::_Tuple_impl<1, std::any> >, std::is_constructible<std::_Tuple_impl<1, std::any>, std::_Tuple_impl<1, std::any>&&> >'
/usr/include/c++/9/any:181:58: required by substitution of 'template<class _ValueType, class _Tp, class _Mgr, typename std::enable_if<std::__and_<std::is_copy_constructible<_Tp>, std::is_constructible<_Tp, _ValueType&&> >::value, bool>::type <anonymous>, typename std::enable_if<(! std::__is_in_place_type<_Tp>::value), bool>::type <anonymous> > std::any::any(_ValueType&&) [with _ValueType = std::_Tuple_impl<1, std::any>; _Tp = std::_Tuple_impl<1, std::any>; _Mgr = std::any::_Manager_external<std::_Tuple_impl<1, std::any> >; typename std::enable_if<std::__and_<std::is_copy_constructible<_Tp>, std::is_constructible<_Tp, _ValueType&&> >::value, bool>::type <anonymous> = <missing>; typename std::enable_if<(! std::__is_in_place_type<_Tp>::value), bool>::type <anonymous> = <missing>]'
/usr/include/c++/9/tuple:231:42: required from 'constexpr std::_Tuple_impl<_Idx, _Head, _Tail ...>::_Tuple_impl(std::_Tuple_impl<_Idx, _Head, _Tail ...>&&) [with long unsigned int _Idx = 0; _Head = Foo*; _Tail = {std::any}]'
/usr/include/c++/9/tuple:983:17: required from 'std::_Bind<_Functor(_Bound_args ...)>::_Bind(std::_Bind<_Functor(_Bound_args ...)>&&) [with _Functor = void (Foo::*)(std::any); _Bound_args = {Foo*, std::any}]'
/usr/include/c++/9/bits/std_function.h:252:39: required from 'static void std::_Function_base::_Base_manager<_Functor>::_M_init_functor(std::_Any_data&, _Functor&&, std::false_type) [with _Functor = std::_Bind<void (Foo::*(Foo*, std::any))(std::any)>; std::false_type = std::integral_constant<bool, false>]'
/usr/include/c++/9/bits/std_function.h:223:19: required from 'static void std::_Function_base::_Base_manager<_Functor>::_M_init_functor(std::_Any_data&, _Functor&&) [with _Functor = std::_Bind<void (Foo::*(Foo*, std::any))(std::any)>]'
/usr/include/c++/9/bits/std_function.h:675:34: required from 'std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = std::_Bind<void (Foo::*(Foo*, std::any))(std::any)>; <template-parameter-2-2> = void; <template-parameter-2-3> = void; _Res = void; _ArgTypes = {}]'
kesan.cpp:22:40: required from here
/usr/include/c++/9/type_traits:150:27: error: 'value' is not a member of 'std::__and_<std::is_copy_constructible<std::_Tuple_impl<1, std::any> >, std::__not_<std::is_constructible<std::_Tuple_impl<1, std::any>, std::_Tuple_impl<1, std::any>&&> >, std::__not_<std::__is_in_place_type<std::_Tuple_impl<1, std::any> > > >'
150 | inline constexpr bool __and_v = __and_<_Bn...>::value;
|
I tested the code in linux g++ (GCC) 8.2.0, g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0,and all of them can be compiled.