Project

General

Profile

Actions

Emulator Issues #10002

closed

IsTriviallyCopyable is stubbed out when using Visual Studio

Added by JosJuice over 7 years ago. Updated over 6 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
Yes
Regression start:
Fixed in:
5.0-6068

Description

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.

Actions #1

Updated by JosJuice over 6 years ago

  • Subject changed from Dolphin expects IsTriviallyCopiable to be true for volatile types to IsTriviallyCopyable is stubbed out when using Visual Studio
  • Status changed from New to Fix pending
  • Milestone deleted (Current)

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

Actions #2

Updated by Lioncash over 6 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).

Actions #3

Updated by JosJuice over 6 years ago

  • Status changed from Fix pending to Fixed
  • Fixed in set to 5.0-6068
Actions

Also available in: Atom PDF