From b40c5ece398b9543f68831d2489b6e14cceec257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 21 Apr 2013 14:09:24 +0200 Subject: [PATCH] MeshTools: don't create reference from rvalue. Spotted by Emscripten/Clang, not found when running clang normally. --- src/MeshTools/Test/CombineIndexedArraysTest.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/MeshTools/Test/CombineIndexedArraysTest.cpp b/src/MeshTools/Test/CombineIndexedArraysTest.cpp index 9473a4123..45fb104aa 100644 --- a/src/MeshTools/Test/CombineIndexedArraysTest.cpp +++ b/src/MeshTools/Test/CombineIndexedArraysTest.cpp @@ -22,6 +22,7 @@ DEALINGS IN THE SOFTWARE. */ +#include #include #include @@ -46,24 +47,29 @@ CombineIndexedArraysTest::CombineIndexedArraysTest() { void CombineIndexedArraysTest::wrongIndexCount() { std::stringstream ss; Error::setOutput(&ss); + std::vector a{0, 1, 0}; + std::vector b{3, 4}; std::vector array; std::vector result = MeshTools::combineIndexedArrays( - std::tuple&, std::vector&>(std::vector{0, 1, 0}, array), - std::tuple&, std::vector&>(std::vector{3, 4}, array)); + std::make_tuple(std::cref(a), std::ref(array)), + std::make_tuple(std::cref(b), std::ref(array))); CORRADE_COMPARE(result.size(), 0); CORRADE_COMPARE(ss.str(), "MeshTools::combineIndexedArrays(): index arrays don't have the same length, nothing done.\n"); } void CombineIndexedArraysTest::combine() { + std::vector a{0, 1, 0}; + std::vector b{3, 4, 3}; + std::vector c{6, 7, 6}; std::vector array1{ 0, 1 }; std::vector array2{ 0, 1, 2, 3, 4 }; std::vector array3{ 0, 1, 2, 3, 4, 5, 6, 7 }; std::vector result = MeshTools::combineIndexedArrays( - std::tuple&, std::vector&>(std::vector{0, 1, 0}, array1), - std::tuple&, std::vector&>(std::vector{3, 4, 3}, array2), - std::tuple&, std::vector&>(std::vector{6, 7, 6}, array3)); + std::make_tuple(std::cref(a), std::ref(array1)), + std::make_tuple(std::cref(b), std::ref(array2)), + std::make_tuple(std::cref(c), std::ref(array3))); CORRADE_COMPARE(result, (std::vector{0, 1, 0})); CORRADE_COMPARE(array1, (std::vector{0, 1}));