Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix two compiling errors #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix two compiling errors #3

wants to merge 1 commit into from

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相关文件。

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