Skip to content

Conversation

@CanftIn
Copy link

@CanftIn CanftIn commented Mar 7, 2019

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

@loveyacper
Copy link
Owner

谢谢指正。目前只用了低版本gcc和clang编译 还没尝试过其它更高版本编译器

@HanWangwang
Copy link

额,我也遇到了一样的问题,很头疼的是,第三个错误我也搞不定。。。

@loveyacper
Copy link
Owner

额,我也遇到了一样的问题,很头疼的是,第三个错误我也搞不定。。。

删除delegate相关文件。

@loveyacper loveyacper force-pushed the master branch 2 times, most recently from 2b70ba8 to 7c7e38e Compare September 4, 2021 06:21
@loveyacper loveyacper force-pushed the master branch 2 times, most recently from 1ad7f69 to 8f9dd7b Compare September 16, 2021 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants