From 7fc58ed1123834e72916fb258bc12090edb5ae5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 4 Aug 2018 20:40:23 +0200 Subject: [PATCH] Animation: work around an ICE involving std::chrono on MSVC 2017. I lost two hours on pinpointing this one. Gah. --- src/Magnum/Animation/Test/PlayerTest.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/Magnum/Animation/Test/PlayerTest.cpp b/src/Magnum/Animation/Test/PlayerTest.cpp index 8dedcaa7f..61e1a3112 100644 --- a/src/Magnum/Animation/Test/PlayerTest.cpp +++ b/src/Magnum/Animation/Test/PlayerTest.cpp @@ -76,17 +76,28 @@ namespace { const struct { const char* name; Float offsetFloat; - std::chrono::nanoseconds offsetChrono; + std::chrono::minutes offsetChrono; bool failsFloat, failsFuzzyFloat; } RunFor100YearsData[]{ {"0", 0.0f, {}, false, false}, - {"1 minute", 60.0f, std::chrono::minutes{1}, false, false}, + {"1 minute", 60.0f, std::chrono::minutes(1), false, false}, {"5 minutes", 5.0f*60.0f, std::chrono::minutes{5}, true, false}, {"30 minutes", 30.0f*60.0f, std::chrono::minutes{30}, true, false}, - {"1 hour", 60.0f*60.0f, std::chrono::hours{1}, true, false}, - {"1 day", 24.0f*60.0f*60.0f, std::chrono::hours{24}, true, true}, - {"100 days", 100.0f*24.0f*60.0f*60.0f, std::chrono::hours{100*24}, true, true}, - {"100 years", 100.0f*365.0f*24.0f*60.0f*60.0f, std::chrono::hours{100*365*24}, true, true}, + {"1 hour", 60.0f*60.0f, std::chrono::minutes{60}, true, false}, + {"1 day", 24.0f*60.0f*60.0f, std::chrono::minutes{24*60}, true, true}, + {"100 days", 100.0f*24.0f*60.0f*60.0f, std::chrono::minutes{100*24*60}, true, true}, + {"100 years", 100.0f*365.0f*24.0f*60.0f*60.0f, + /* MSVC 2017 (but not 2015) ICEs when assigning hours to minutes + (or just any other two different chrono types) in a struct array + initializer (not when there's just a struct and also not when + the struct is only a chrono member itself). Keeping at least one + instance here so I can monitor when this gets fixed. */ + #if !defined(CORRADE_MSVC2017_COMPATIBILITY) || defined(CORRADE_MSVC2015_COMPATIBLITY) + std::chrono::hours{100*365*24}, + #else + std::chrono::minutes{100*365*24*60}, + #endif + true, true}, }; }