Emulator Issues #10002
IsTriviallyCopyable is stubbed out when using Visual Studio
The details are described here: https://github.com/dolphin-emu/dolphin/pull/2218
We have already hacked IsTriviallyCopyable to always return 1 on Visual Studio because it otherwise would fail for volatile types (starting with Visual Studio 2015). IsTriviallyCopyable might start failing for volatile types on other compilers too in the future, so we need some sort of fix, ideally removing usages of volatile.
#1 Updated by JosJuice almost 2 years ago
- Milestone deleted (
- Status changed from New to Fix pending
- Subject changed from Dolphin expects IsTriviallyCopiable to be true for volatile types to IsTriviallyCopyable is stubbed out when using Visual Studio
The part about failing on other compilers in the future might not be true - I didn't notice that we were using std::remove_volatile. (It seems like VS doesn't handle std::remove_volatile the way we want for structs that have volatile members, unlike other compilers, since SCPFifoStruct currently trips our static assert if you try to make VS use the std::is_trivially_copyable path in ChunkFile.h.)
Either way, removing the hack we added for VS2015+ would be nice, so I've made a PR for it: https://github.com/dolphin-emu/dolphin/pull/6190
#2 Updated by Lioncash almost 2 years ago
The usage of std::remove_volatile is also incorrect in this context conceptually. Volatile types are inherently non-trivially copyable, so this macro allows breaking that which can lead to potentially invoking undefined behavior (for example, passing a volatile qualified type to std::memcpy is breaking the precondition that the input and output objects be trivially copyable).
#3 Updated by JosJuice almost 2 years ago
- Fixed in set to 5.0-6068
- Status changed from Fix pending to Fixed