From 31eca7a774cac98ddefdbb5f0b487aaa759abc03 Mon Sep 17 00:00:00 2001 From: Chiraffollo Date: Tue, 23 Jul 2024 16:19:30 +0200 Subject: [PATCH] Fix issue #931 Superfluous curly braces removed --- include/etl/vector.h | 4 ++-- test/test_vector.cpp | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/include/etl/vector.h b/include/etl/vector.h index ac2f081e5..970f82aea 100644 --- a/include/etl/vector.h +++ b/include/etl/vector.h @@ -1376,7 +1376,7 @@ namespace etl template constexpr auto make_vector(T&&... t) -> etl::vector, sizeof...(T)> { - return { { etl::forward(t)... } }; + return { etl::forward(t)... }; } #endif @@ -1674,7 +1674,7 @@ namespace etl template constexpr auto make_vector(T*... t) -> etl::vector, sizeof...(T)> { - return { { etl::forward(t)... } }; + return { etl::forward(t)... }; } #endif diff --git a/test/test_vector.cpp b/test/test_vector.cpp index ce85bcfe7..38c707910 100644 --- a/test/test_vector.cpp +++ b/test/test_vector.cpp @@ -1495,6 +1495,29 @@ namespace } #endif + //************************************************************************* +#if ETL_HAS_INITIALIZER_LIST + TEST(test_make_vector_issue_931_two_pairs) + { + auto data3 = etl::make_vector(etl::make_pair(1, 2), + etl::make_pair(3, 4), + etl::make_pair(5, 6)); + CHECK_EQUAL(1, data3[0].first); + CHECK_EQUAL(2, data3[0].second); + CHECK_EQUAL(3, data3[1].first); + CHECK_EQUAL(4, data3[1].second); + CHECK_EQUAL(5, data3[2].first); + CHECK_EQUAL(6, data3[2].second); + + auto data2 = etl::make_vector(etl::make_pair(1, 2), + etl::make_pair(3, 4)); + CHECK_EQUAL(1, data3[0].first); + CHECK_EQUAL(2, data3[0].second); + CHECK_EQUAL(3, data3[1].first); + CHECK_EQUAL(4, data3[1].second); + } +#endif + //************************************************************************* TEST(test_fill) {