diff --git a/CMakeLists.txt b/CMakeLists.txt index 23a96b89f..ab7f415dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,7 +146,8 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") elseif(MSVC) # Visual Studio pedantic build settings # warning C4512: assignment operator could not be generated - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /WX /wd4512") + # warning C4316: object allocated on the heap may not be aligned + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /WX /wd4512 /wd4316") endif() if(FLATBUFFERS_CODE_COVERAGE) diff --git a/include/flatbuffers/flexbuffers.h b/include/flatbuffers/flexbuffers.h index 2c7a25ec7..3853d50f7 100644 --- a/include/flatbuffers/flexbuffers.h +++ b/include/flatbuffers/flexbuffers.h @@ -1281,7 +1281,7 @@ class Builder FLATBUFFERS_FINAL_CLASS { // Write vector. First the keys width/offset if available, and size. if (keys) { WriteOffset(keys->u_, byte_width); - Write(1U << keys->min_bit_width_, byte_width); + Write(1ULL << keys->min_bit_width_, byte_width); } if (!fixed) Write(vec_len, byte_width); // Then the actual data.