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

redifinition of struct hash<coroutine_handle<_Tp> > #118

Open
1 of 2 tasks
TannyXie opened this issue Jun 18, 2022 · 8 comments
Open
1 of 2 tasks

redifinition of struct hash<coroutine_handle<_Tp> > #118

TannyXie opened this issue Jun 18, 2022 · 8 comments
Assignees

Comments

@TannyXie
Copy link

TannyXie commented Jun 18, 2022

Search before asking

  • I searched the issues and found no similar issues.

What happened + What you expected to happen

I'm on MacOS and I use g++-11 (11.2.0) for both CXX and CC. I come across the error when build.

/async_simple/async_simple/experimental/coroutine.h:400:8: error: 
      redefinition of 'hash<coroutine_handle<_Tp> >'
struct hash<coroutine_handle<_Tp> > {
/include/c++/v1/experimental/coroutine:323:8: note: 
      previous definition is here
struct hash<_VSTD_CORO::coroutine_handle<_Tp> > {

Reproduction way

Anything else

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!
@ChuanqiXu9
Copy link
Collaborator

It is weird. I remember I met the problem before and have fixed it. Would you like to check the commit id?

@ChuanqiXu9 ChuanqiXu9 self-assigned this Jun 20, 2022
@TannyXie
Copy link
Author

I'm on commit e342335.

@ChuanqiXu9
Copy link
Collaborator

I'm on commit e342335.

Would you like to move to HEAD? It should be able to solve this.

@TannyXie
Copy link
Author

I'm getting a new error.

async_simple/async_simple/Common.h:44:9: error: unknown attribute 'likely' ignored [-Werror,-Wunknown-attributes]
        LIKELY { return; }
        ^
async_simple/async_simple/Common.h:25:18: note: expanded from macro 'LIKELY'
#define LIKELY [[likely]]
                 ^

@qicosmos
Copy link
Collaborator

qicosmos commented Jun 22, 2022

I think it's the compiler problem, use a c++ compiler which can support c++20.

@ChuanqiXu9
Copy link
Collaborator

ChuanqiXu9 commented Jun 22, 2022

I'm getting a new error.

async_simple/async_simple/Common.h:44:9: error: unknown attribute 'likely' ignored [-Werror,-Wunknown-attributes]
        LIKELY { return; }
        ^
async_simple/async_simple/Common.h:25:18: note: expanded from macro 'LIKELY'
#define LIKELY [[likely]]
                 ^

It is odd since we've tried GCC-10.3 it is in the CI system. But our method of detecting the presence of [[likely]] is not good enough as well. I've sent #120. Would you like to try again?

@TannyXie
Copy link
Author

TannyXie commented Jun 22, 2022

In file included from /Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/test/FutureAwaiterTest.cpp:16:
/Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/FutureAwaiter.h:44:35: error: expected ';' at end of declaration
auto operator co_await(T&& future) requires IsFuture<std::decay_t<T>>::value {
                                  ^
                                  ;
/Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/FutureAwaiter.h:44:36: error: expected unqualified-id
auto operator co_await(T&& future) requires IsFuture<std::decay_t<T>>::value {
                                   ^
In file included from /Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/test/FutureAwaiterTest.cpp:17:
In file included from /Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/Lazy.h:22:
/Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/ViaCoroutine.h:97:25: error: function 'operator co_await<std::experimental::coroutines_v1::suspend_always>' with deduced return type cannot
      be used before it is defined
    static ViaCoroutine create(Executor* ex) { co_return; }
                        ^
/Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/FutureAwaiter.h:44:6: note: 'operator co_await<std::experimental::coroutines_v1::suspend_always>' declared here
auto operator co_await(T&& future) requires IsFuture<std::decay_t<T>>::value {
     ^
/Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/test/FutureAwaiterTest.cpp:41:18: error: function 'operator co_await<std::experimental::coroutines_v1::suspend_always>' with deduced return
      type cannot be used before it is defined
    auto lazy1 = [&]() -> Lazy<> {
                 ^
/Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/FutureAwaiter.h:44:6: note: 'operator co_await<std::experimental::coroutines_v1::suspend_always>' declared here
auto operator co_await(T&& future) requires IsFuture<std::decay_t<T>>::value {
     ^
In file included from /Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/test/FutureAwaiterTest.cpp:17:
In file included from /Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/Lazy.h:22:
In file included from /Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/ViaCoroutine.h:30:
/Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/Traits.h:70:12: error: call to deleted constructor of 'async_simple::Future<int>'
    return std::forward<Awaitable>(awaitable);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/ViaCoroutine.h:183:26: note: in instantiation of function template specialization
      'async_simple::coro::detail::getAwaiter<async_simple::Future<int> &, 0, 0>' requested here
        decltype(detail::getAwaiter(std::forward<Awaitable>(awaitable)));
                         ^
/Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/Lazy.h:97:24: note: in instantiation of function template specialization
      'async_simple::coro::detail::coAwait<async_simple::Future<int> &, 0>' requested here
        return detail::coAwait(_executor, std::forward<Awaitable>(awaitable));
                       ^
/Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/test/FutureAwaiterTest.cpp:46:20: note: in instantiation of function template specialization
      'async_simple::coro::detail::LazyPromiseBase::await_transform<async_simple::Future<int> &>' requested here
        auto val = co_await fut;
                   ^
/Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/Future.h:63:5: note: 'Future' has been explicitly marked deleted here
    Future(const Future&) = delete;
    ^
In file included from /Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/test/FutureAwaiterTest.cpp:17:
In file included from /Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/Lazy.h:22:
/Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/ViaCoroutine.h:139:34: error: no member named 'await_suspend' in 'async_simple::Future<int>'
        std::declval<Awaiter&>().await_suspend(std::declval<HandleType>()));
        ~~~~~~~~~~~~~~~~~~~~~~~~ ^
/Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/ViaCoroutine.h:184:12: note: in instantiation of template class 'async_simple::coro::detail::ViaAsyncAwaiter<async_simple::Future<int> >'
      requested here
    return ViaAsyncAwaiter<std::decay_t<AwaiterType>>(
           ^
/Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/Lazy.h:97:24: note: in instantiation of function template specialization
      'async_simple::coro::detail::coAwait<async_simple::Future<int> &, 0>' requested here
        return detail::coAwait(_executor, std::forward<Awaitable>(awaitable));
                       ^
/Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/test/FutureAwaiterTest.cpp:46:20: note: in instantiation of function template specialization
      'async_simple::coro::detail::LazyPromiseBase::await_transform<async_simple::Future<int> &>' requested here
        auto val = co_await fut;
                   ^
/Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/test/FutureAwaiterTest.cpp:46:20: note: call to 'await_transform' implicitly required by 'co_await' here
        auto val = co_await fut;
                   ^        ~~~
/Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/test/FutureAwaiterTest.cpp:50:18: error: function 'operator co_await<std::experimental::coroutines_v1::suspend_always>' with deduced return
      type cannot be used before it is defined
    auto lazy2 = [&]() -> Lazy<> {
                 ^
/Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/FutureAwaiter.h:44:6: note: 'operator co_await<std::experimental::coroutines_v1::suspend_always>' declared here
auto operator co_await(T&& future) requires IsFuture<std::decay_t<T>>::value {
     ^
/Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/test/FutureAwaiterTest.cpp:57:20: error: function 'operator co_await<async_simple::coro::detail::ViaAsyncAwaiter<async_simple::Future<int> >
      >' with deduced return type cannot be used before it is defined
        auto val = co_await std::move(fut);
                   ^
/Users/tannyxie/Documents/Project Preparation/github/async_simple/async_simple/coro/FutureAwaiter.h:44:6: note: 'operator co_await<async_simple::coro::detail::ViaAsyncAwaiter<async_simple::Future<int> > >' declared here
auto operator co_await(T&& future) requires IsFuture<std::decay_t<T>>::value {
     ^
8 errors generated.
make[2]: *** [async_simple/coro/test/CMakeFiles/async_simple_coro_test.dir/FutureAwaiterTest.cpp.o] Error 1
make[1]: *** [async_simple/coro/test/CMakeFiles/async_simple_coro_test.dir/all] Error 2
make: *** [all] Error 2

@ChuanqiXu9
Copy link
Collaborator

It looks like your compiler is not new enough indeed. It couldn't recognize requires keyword. Would you like to check the used compiler?

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

No branches or pull requests

3 participants