diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2016-07-24 12:50:15 -0700 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2016-11-02 18:23:21 +0000 |
commit | f96f1bfd600a2a77a82d36407b2d83994000fa26 (patch) | |
tree | 17e581a0e4649c3c509794de5b4159b048e359ec | |
parent | d5da99a1e2602e99ed916206df1728eb540a7dc5 (diff) |
Fix Clang warning about overwriting a vtable
statevariant_p.h:100:20: warning: destination for this 'memcpy' call is a pointer to class containing a dynamic class 'BlendEquationArguments'; vtable pointer will be overwritten [-Wdynamic-class-memaccess]
statevariant_p.h:100:20: note: explicitly cast the pointer to silence this warning
Change-Id: I149e0540c00745fe8119fffd146452409ca5c945
Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r-- | src/render/renderstates/statevariant_p.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/render/renderstates/statevariant_p.h b/src/render/renderstates/statevariant_p.h index f2a631d2e..e13599e75 100644 --- a/src/render/renderstates/statevariant_p.h +++ b/src/render/renderstates/statevariant_p.h @@ -87,17 +87,17 @@ struct StateVariant u_Data() { // Assumes the above types don't need to have their ctor called - memset(this, 0, sizeof(u_Data)); + memset(static_cast<void *>(this), 0, sizeof(u_Data)); } u_Data(const u_Data &other) { - memcpy(this, &other, sizeof(u_Data)); + memcpy(static_cast<void *>(this), static_cast<const void *>(&other), sizeof(u_Data)); } u_Data& operator=(const u_Data &other) { - memcpy(this, &other, sizeof(u_Data)); + memcpy(static_cast<void *>(this), static_cast<const void *>(&other), sizeof(u_Data)); return *this; } @@ -121,7 +121,7 @@ struct StateVariant #if !defined(_MSC_VER) || (_MSC_VER > 1800) // all union members start at the same memory address // so we can just write into whichever we want - memcpy(&(v.data), &state, sizeof(state)); + memcpy(static_cast<void *>(&v.data), static_cast<const void *>(&state), sizeof(state)); #else v.m_impl.reset(new GenericState(state)); #endif |