Browse Source

Animation: work around an ICE involving std::chrono on MSVC 2017.

I lost two hours on pinpointing this one. Gah.
pull/191/head
Vladimír Vondruš 8 years ago
parent
commit
7fc58ed112
  1. 23
      src/Magnum/Animation/Test/PlayerTest.cpp

23
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},
};
}

Loading…
Cancel
Save