From 983b986303769c90248cfd2a33119b18fd612091 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sun, 12 Nov 2017 15:12:17 +0100 Subject: [PATCH] Don't delete BitField copy assignment operator on VS --- Source/Core/Common/BitField.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/Core/Common/BitField.h b/Source/Core/Common/BitField.h index c8a81a092a..6866282298 100644 --- a/Source/Core/Common/BitField.h +++ b/Source/Core/Common/BitField.h @@ -124,15 +124,18 @@ public: // so that we can use this within unions constexpr BitField() = default; +// Visual Studio (as of VS2017) considers BitField to not be trivially +// copyable if we delete this copy assignment operator. +// https://developercommunity.visualstudio.com/content/problem/101208/c-compiler-is-overly-strict-regarding-whether-a-cl.html +#ifndef _MSC_VER // We explicitly delete the copy assignment operator here, because the // default copy assignment would copy the full storage value, rather than // just the bits relevant to this particular bit field. // Ideally, we would just implement the copy assignment to copy only the - // relevant bits, but this requires compiler support for unrestricted - // unions. - // TODO: Implement this operator properly once all target compilers - // support unrestricted unions. + // relevant bits, but we're prevented from doing that because the savestate + // code expects that this class is trivially copyable. BitField& operator=(const BitField&) = delete; +#endif __forceinline BitField& operator=(T val) {