From 201c382e86a74212d922343b41c6c720105cd0e6 Mon Sep 17 00:00:00 2001 From: Mateusz Jakub Fila Date: Wed, 25 Feb 2026 16:28:58 +0100 Subject: [PATCH] add overload to resolve ambiguity in alien coroutine return_value --- include/CoroutineTests/alien/algorithm.hpp | 4 ++++ include/CoroutineTests/alien/manual_algorithm.hpp | 2 ++ include/CoroutineTests/alien/subtool.hpp | 2 ++ include/CoroutineTests/alien/tool.hpp | 2 ++ 4 files changed, 10 insertions(+) diff --git a/include/CoroutineTests/alien/algorithm.hpp b/include/CoroutineTests/alien/algorithm.hpp index 06cbe9b..c74a842 100644 --- a/include/CoroutineTests/alien/algorithm.hpp +++ b/include/CoroutineTests/alien/algorithm.hpp @@ -115,6 +115,10 @@ struct Task::promise_type { void return_value(T&& value) { m_promise.set_value(std::forward(value)); } + // Overload to resolve ambiguity + void return_value(ResultType value) { + m_promise.set_value(std::move(value)); + } }; template diff --git a/include/CoroutineTests/alien/manual_algorithm.hpp b/include/CoroutineTests/alien/manual_algorithm.hpp index 1a44d3a..16b8d22 100644 --- a/include/CoroutineTests/alien/manual_algorithm.hpp +++ b/include/CoroutineTests/alien/manual_algorithm.hpp @@ -113,6 +113,8 @@ struct Task::promise_type { void return_value(T&& value) { m_value = std::forward(value); } + // Overload to resolve ambiguity + void return_value(ResultType value) { m_value.emplace(std::move(value)); } }; template diff --git a/include/CoroutineTests/alien/subtool.hpp b/include/CoroutineTests/alien/subtool.hpp index f394228..43a18e8 100644 --- a/include/CoroutineTests/alien/subtool.hpp +++ b/include/CoroutineTests/alien/subtool.hpp @@ -117,6 +117,8 @@ struct ReturnHelper { void return_value(T&& value) { m_value.emplace(std::forward(value)); } + // Overload to resolve ambiguity + void return_value(ResultType value) { m_value.emplace(std::move(value)); } }; // Specialization for void return type diff --git a/include/CoroutineTests/alien/tool.hpp b/include/CoroutineTests/alien/tool.hpp index 8a50379..4e4b033 100644 --- a/include/CoroutineTests/alien/tool.hpp +++ b/include/CoroutineTests/alien/tool.hpp @@ -117,6 +117,8 @@ struct ReturnHelper { void return_value(T&& value) { m_value.emplace(std::forward(value)); } + // Overload to resolve ambiguity + void return_value(ResultType value) { m_value.emplace(std::move(value)); } }; // Specialization for void return type