ananas
ananas copied to clipboard
fix two compiling errors
One leak <functional> head file. Another is ucontext
to uncontext_t
.
The third error appears in delegate file. I didn't fix and just delete related files to let compile pass.
delegate file error output is that:
In file included from /usr/include/c++/8.2.1/functional:59,
from /home/canftin/2019/ananas/util/Delegate.h:4,
from /home/canftin/2019/ananas/unittest/DelegateTest.cc:3:
/usr/include/c++/8.2.1/bits/std_function.h: In instantiation of ‘_Functor* std::function<_Res(_ArgTypes ...)>::target() [with _Functor = void(int&); _Res = void; _ArgTypes = {int&}]’:
/home/canftin/2019/ananas/util/Delegate.h:96:29: required from ‘void ananas::Delegate<void(Args ...)>::disconnect(F&&) [with F = void (&)(int&); Args = {int&}]’
/home/canftin/2019/ananas/util/Delegate.h:69:9: required from ‘ananas::Delegate<void(Args ...)>::Self& ananas::Delegate<void(Args ...)>::operator-=(F&&) [with F = void (&)(int&); Args = {int&}; ananas::Delegate<void(Args ...)>::Self = ananas::Delegate<void(int&)>]’
/home/canftin/2019/ananas/unittest/DelegateTest.cc:17:11: required from here
/usr/include/c++/8.2.1/bits/std_function.h:714:9: error: invalid use of const_cast with type ‘void (*)(int&)’, which is a pointer or reference to a function type
return const_cast<_Functor*>(__func);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/8.2.1/bits/std_function.h: In instantiation of ‘_Functor* std::function<_Res(_ArgTypes ...)>::target() [with _Functor = void(int); _Res = void; _ArgTypes = {int}]’:
/home/canftin/2019/ananas/util/Delegate.h:96:29: required from ‘void ananas::Delegate<void(Args ...)>::disconnect(F&&) [with F = void (&)(int); Args = {int}]’
/home/canftin/2019/ananas/util/Delegate.h:69:9: required from ‘ananas::Delegate<void(Args ...)>::Self& ananas::Delegate<void(Args ...)>::operator-=(F&&) [with F = void (&)(int); Args = {int}; ananas::Delegate<void(Args ...)>::Self = ananas::Delegate<void(int)>]’
/home/canftin/2019/ananas/unittest/DelegateTest.cc:64:11: required from here
/usr/include/c++/8.2.1/bits/std_function.h:714:9: error: invalid use of const_cast with type ‘void (*)(int)’, which is a pointer or reference to a function type
谢谢指正。目前只用了低版本gcc和clang编译 还没尝试过其它更高版本编译器
额,我也遇到了一样的问题,很头疼的是,第三个错误我也搞不定。。。
额,我也遇到了一样的问题,很头疼的是,第三个错误我也搞不定。。。
删除delegate相关文件。