Skip to content

Clang conformance - #779

Merged
Kenny Kerr (kennykerr) merged 2 commits into
masterfrom
clang
Oct 26, 2020
Merged

Clang conformance#779
Kenny Kerr (kennykerr) merged 2 commits into
masterfrom
clang

Conversation

@kennykerr

@kennykerr Kenny Kerr (kennykerr) commented Oct 26, 2020

Copy link
Copy Markdown
Collaborator

Fixes #566

Looks like Clang defines __cpp_coroutines but not __cpp_lib_coroutine as it should. Anyway, this fix should tide us over until Clang offers full coroutine support. This change just ifdefs away the mentions of operator co_await if WINRT_IMPL_COROUTINES is not defined.

Also, silenced a few more warnings about dependent template names.

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; }

Copy link
Copy Markdown
Member

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_await and could stay in its original location, I think.

Copy link
Copy Markdown
Collaborator Author

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.

template <typename T>
decltype(auto) get_awaiter(T&& value) noexcept
{
#ifdef WINRT_IMPL_COROUTINES

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need this #ifdef any more. has_co_await_member and has_co_await_free will always be false if WINRT_IMPL_COROUTINES is not defined, so we fall through to the last case, which requires the type to be its own awaiter (and if we move the find_awaitable_member outside the #ifdef it will work), it will look for an await_ready which is fine.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, Clang currently looks inside the if constexpr regardless and fails to compile.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yeah, forgot about that. Even though it's if constexpr'd out, it still has to compile.

@kennykerr
Kenny Kerr (kennykerr) merged commit 22f3b70 into master Oct 26, 2020
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.

Cannot use clang-tidy in combination with winrt/base.h

2 participants