init: fix hiding of move constructors of Result<T>
This is needed to have Result<Result<T>> work correctly.
Test: init unit tests
Change-Id: If7d23d1ea13f3727b567d3baf0eee1d8d0e5a196
diff --git a/init/result.h b/init/result.h
index 36c3b83..fc03962 100644
--- a/init/result.h
+++ b/init/result.h
@@ -153,8 +153,14 @@
template <typename T>
class Result {
public:
- template <typename... U>
- Result(U&&... result) : contents_(std::in_place_index_t<0>(), std::forward<U>(result)...) {}
+ Result() {}
+
+ template <typename U, typename... V,
+ typename = std::enable_if_t<!(std::is_same_v<std::decay_t<U>, Result<T>> &&
+ sizeof...(V) == 0)>>
+ Result(U&& result, V&&... results)
+ : contents_(std::in_place_index_t<0>(), std::forward<U>(result),
+ std::forward<V>(results)...) {}
Result(Error&& error) : contents_(std::in_place_index_t<1>(), error.str(), error.get_errno()) {}
Result(const ResultError& result_error)