-
Notifications
You must be signed in to change notification settings - Fork 262
Clang conformance #779
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
Clang conformance #779
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -109,14 +109,15 @@ namespace winrt::impl | |
| template <typename T> | ||
| class awaiter_finder | ||
| { | ||
| template <typename U, typename = decltype(std::declval<U>().await_ready())> static constexpr bool find_awaitable_member(int) { return true; } | ||
| template <typename> static constexpr bool find_awaitable_member(...) { return false; } | ||
|
|
||
| template <typename U, typename = decltype(std::declval<U>().operator co_await())> static constexpr bool find_co_await_member(int) { return true; } | ||
| template <typename> static constexpr bool find_co_await_member(...) { return false; } | ||
| template <typename> static constexpr bool find_co_await_free(...) { return false; } | ||
|
|
||
| #ifdef WINRT_IMPL_COROUTINES | ||
| template <typename U, typename = decltype(std::declval<U>().await_ready())> static constexpr bool find_awaitable_member(int) { return true; } | ||
| template <typename U, typename = decltype(std::declval<U>().operator co_await())> static constexpr bool find_co_await_member(int) { return true; } | ||
| template <typename U, typename = decltype(operator co_await(std::declval<U>()))> static constexpr bool find_co_await_free(int) { return true; } | ||
| template <typename> static constexpr bool find_co_await_free(...) { return false; } | ||
| #endif | ||
|
|
||
| public: | ||
|
|
||
|
|
@@ -202,6 +203,7 @@ namespace winrt::impl | |
| template <typename T> | ||
| decltype(auto) get_awaiter(T&& value) noexcept | ||
| { | ||
| #ifdef WINRT_IMPL_COROUTINES | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we don't need this
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately, Clang currently looks inside the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, yeah, forgot about that. Even though it's |
||
| if constexpr (awaiter_finder<T>::has_co_await_member) | ||
| { | ||
| static_assert(!awaiter_finder<T>::has_co_await_free, "Ambiguous operator co_await (as both member and free function)."); | ||
|
|
@@ -216,6 +218,9 @@ namespace winrt::impl | |
| static_assert(awaiter_finder<T>::has_awaitable_member, "Not an awaitable type"); | ||
| return static_cast<T&&>(value); | ||
| } | ||
| #else | ||
| return static_cast<T&&>(value); | ||
| #endif | ||
| } | ||
|
|
||
| template <typename T> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one doesn't mention
operator co_awaitand could stay in its original location, I think.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was just cleaner to group the trues and falses together.