Fix compilation with MSVC of volatile assignment operator
Bug: dawn:230 Change-Id: Ie6e4ddf52132a6980d86c9d80524385b51d9d0d6 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12200 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
2e666bd5de
commit
b0cdf95213
|
@ -369,8 +369,12 @@ namespace dawn_wire {
|
|||
ObjectHandle::ObjectHandle() = default;
|
||||
ObjectHandle::ObjectHandle(ObjectId id, ObjectSerial serial) : id(id), serial(serial) {}
|
||||
ObjectHandle::ObjectHandle(const volatile ObjectHandle& rhs) : id(rhs.id), serial(rhs.serial) {}
|
||||
ObjectHandle& ObjectHandle::operator=(const ObjectHandle& rhs) = default;
|
||||
ObjectHandle& ObjectHandle::operator=(const volatile ObjectHandle& rhs) {
|
||||
ObjectHandle& ObjectHandle::AssignFrom(const ObjectHandle& rhs) {
|
||||
id = rhs.id;
|
||||
serial = rhs.serial;
|
||||
return *this;
|
||||
}
|
||||
ObjectHandle& ObjectHandle::AssignFrom(const volatile ObjectHandle& rhs) {
|
||||
id = rhs.id;
|
||||
serial = rhs.serial;
|
||||
return *this;
|
||||
|
|
|
@ -28,8 +28,15 @@ namespace dawn_wire {
|
|||
ObjectHandle();
|
||||
ObjectHandle(ObjectId id, ObjectSerial serial);
|
||||
ObjectHandle(const volatile ObjectHandle& rhs);
|
||||
ObjectHandle& operator=(const ObjectHandle& rhs);
|
||||
ObjectHandle& operator=(const volatile ObjectHandle& rhs);
|
||||
|
||||
// MSVC has a bug where it thinks the volatile copy assignment is a duplicate.
|
||||
// Workaround this by forwarding to a different function AssignFrom.
|
||||
template <typename T>
|
||||
ObjectHandle& operator=(const T& rhs) {
|
||||
return AssignFrom(rhs);
|
||||
}
|
||||
ObjectHandle& AssignFrom(const ObjectHandle& rhs);
|
||||
ObjectHandle& AssignFrom(const volatile ObjectHandle& rhs);
|
||||
};
|
||||
|
||||
enum class DeserializeResult {
|
||||
|
|
Loading…
Reference in New Issue