async_simple
async_simple copied to clipboard
redifinition of struct hash<coroutine_handle<_Tp> >
Search before asking
- [x] 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!
It is weird. I remember I met the problem before and have fixed it. Would you like to check the commit id?
I'm on commit e342335eda9.
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]]
^
I think it's the compiler problem, use a c++ compiler which can support c++20.
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 https://github.com/alibaba/async_simple/pull/120. Would you like to try again?
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
It looks like your compiler is not new enough indeed. It couldn't recognize requires
keyword. Would you like to check the used compiler?