From b50c2bf8a8c2fbcb2cee2c438779b745e9d82533 Mon Sep 17 00:00:00 2001 From: Denis Blank Date: Fri, 9 Mar 2018 05:23:36 +0100 Subject: [PATCH] Fix non default constructible values in compositions * Add a test case for the non default constructible case --- include/continuable/detail/composition-all.hpp | 5 +++-- .../multi/test-continuable-connection-all-seq.hpp | 13 +++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/include/continuable/detail/composition-all.hpp b/include/continuable/detail/composition-all.hpp index 65f2d8a..186a7b3 100644 --- a/include/continuable/detail/composition-all.hpp +++ b/include/continuable/detail/composition-all.hpp @@ -56,13 +56,14 @@ struct all_hint_deducer { template static constexpr auto deduce(hints::signature_hint_tag) { - return First{}; + return std::declval(); } template static constexpr auto deduce(hints::signature_hint_tag) { - return spread_this(First{}, Second{}, Args{}...); + return spread_this(std::declval(), std::declval(), + std::declval()...); } template < diff --git a/test/unit-test/multi/test-continuable-connection-all-seq.hpp b/test/unit-test/multi/test-continuable-connection-all-seq.hpp index f0eac07..fb32a4d 100644 --- a/test/unit-test/multi/test-continuable-connection-all-seq.hpp +++ b/test/unit-test/multi/test-continuable-connection-all-seq.hpp @@ -49,12 +49,25 @@ void test_all_seq_op(Supplier&& supply, OperatorConnector&& op) { } } +class non_default_constructible { +public: + explicit non_default_constructible(int) { + } +}; + template void test_all_seq_aggregate(Supplier&& supply, AggregateConnector&& ag) { { auto chain = ag(supply(1, 2), supply(3, 4), supply(5, 6)); EXPECT_ASYNC_RESULT(std::move(chain), 1, 2, 3, 4, 5, 6); } + + { + auto chain = + ag(supply(1, 2), supply(non_default_constructible{1}), supply(5, 6)); + ASSERT_ASYNC_TYPES(std::move(chain), int, int, non_default_constructible, + int, int); + } } #endif // TEST_CONTINUABLE_CONNECTION_HPP__