From ad12575a085559c627c67ddbd93f9bb7ef20bec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 6 Oct 2020 19:39:17 +0200 Subject: [PATCH] ShaderTools: C++, you're stupid. Fuck you. Like, it's INEVITABLE to have a 100-line std::lerp() implementation for questionable reasons but such dead-simple thing as std::pair doing moves instead of copies where expected that should have been done CORRECTLY back in 2011 still isn't working reliably across implementations?! I guess I'm doing my Containers::Pair soon as well, then. --- .../ShaderTools/Test/AbstractConverterTest.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Magnum/ShaderTools/Test/AbstractConverterTest.cpp b/src/Magnum/ShaderTools/Test/AbstractConverterTest.cpp index b5a946602..7068f48bf 100644 --- a/src/Magnum/ShaderTools/Test/AbstractConverterTest.cpp +++ b/src/Magnum/ShaderTools/Test/AbstractConverterTest.cpp @@ -309,7 +309,14 @@ void AbstractConverterTest::validateDataCustomStringDeleter() { } std::pair doValidateData(Stage, const Containers::ArrayView) override { - return {{}, Containers::String{"", 0, [](char*, std::size_t){}}}; + /* libc++ and MSVC STL is STUPID and doing + `return {{}, Containers::String{...}};` + will do a COPY, even though not needed. That then of course + discards the custom deleter and makes the test fail. Oh C++, do + I really have to reimplement even std::pair, FFS?! */ + std::pair out; + out.second = Containers::String{"", 0, [](char*, std::size_t){}}; + return out; } } converter; @@ -416,7 +423,14 @@ void AbstractConverterTest::validateFileCustomStringDeleter() { } std::pair doValidateFile(Stage, Containers::StringView) override { - return {{}, Containers::String{"", 0, [](char*, std::size_t){}}}; + /* libc++ and MSVC STL is STUPID and doing + `return {{}, Containers::String{...}};` + will do a COPY, even though not needed. That then of course + discards the custom deleter and makes the test fail. Oh C++, do + I really have to reimplement even std::pair, FFS?! */ + std::pair out; + out.second = Containers::String{"", 0, [](char*, std::size_t){}}; + return out; } } converter;