diff --git a/strings/base_coroutine_threadpool.h b/strings/base_coroutine_threadpool.h index fded22c85..3a646a55f 100644 --- a/strings/base_coroutine_threadpool.h +++ b/strings/base_coroutine_threadpool.h @@ -109,14 +109,15 @@ namespace winrt::impl template class awaiter_finder { - template ().await_ready())> static constexpr bool find_awaitable_member(int) { return true; } template static constexpr bool find_awaitable_member(...) { return false; } - - template ().operator co_await())> static constexpr bool find_co_await_member(int) { return true; } template static constexpr bool find_co_await_member(...) { return false; } + template static constexpr bool find_co_await_free(...) { return false; } +#ifdef WINRT_IMPL_COROUTINES + template ().await_ready())> static constexpr bool find_awaitable_member(int) { return true; } + template ().operator co_await())> static constexpr bool find_co_await_member(int) { return true; } template ()))> static constexpr bool find_co_await_free(int) { return true; } - template static constexpr bool find_co_await_free(...) { return false; } +#endif public: @@ -202,6 +203,7 @@ namespace winrt::impl template decltype(auto) get_awaiter(T&& value) noexcept { +#ifdef WINRT_IMPL_COROUTINES if constexpr (awaiter_finder::has_co_await_member) { static_assert(!awaiter_finder::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::has_awaitable_member, "Not an awaitable type"); return static_cast(value); } +#else + return static_cast(value); +#endif } template diff --git a/strings/base_reference_produce.h b/strings/base_reference_produce.h index 30baf0584..a8c5c4018 100644 --- a/strings/base_reference_produce.h +++ b/strings/base_reference_produce.h @@ -274,24 +274,24 @@ namespace winrt::impl } if constexpr (std::is_enum_v) { - if (auto temp = value.try_as>()) + if (auto temp = value.template try_as>()) { return temp.Value(); } else { - return static_cast(value.as>>().Value()); + return static_cast(value.template as>>().Value()); } } #ifdef WINRT_IMPL_IUNKNOWN_DEFINED else if constexpr (std::is_same_v) { - return value.as>().Value(); + return value.template as>().Value(); } #endif else { - return value.as>().Value(); + return value.template as>().Value(); } } @@ -300,12 +300,12 @@ namespace winrt::impl { if constexpr (std::is_enum_v) { - if (auto temp = value.try_as>()) + if (auto temp = value.template try_as>()) { return temp.Value(); } - if (auto temp = value.try_as>>()) + if (auto temp = value.template try_as>>()) { return static_cast(temp.Value()); } @@ -313,7 +313,7 @@ namespace winrt::impl #ifdef WINRT_IMPL_IUNKNOWN_DEFINED else if constexpr (std::is_same_v) { - if (auto temp = value.try_as>()) + if (auto temp = value.template try_as>()) { return temp.Value(); } @@ -321,7 +321,7 @@ namespace winrt::impl #endif else { - if (auto temp = value.try_as>()) + if (auto temp = value.template try_as>()) { return temp.Value(); }