diff --git a/src/lib_json/CMakeLists.txt b/src/lib_json/CMakeLists.txt index 39aa0b371..dc3d9772e 100644 --- a/src/lib_json/CMakeLists.txt +++ b/src/lib_json/CMakeLists.txt @@ -7,6 +7,10 @@ ELSE(JSONCPP_LIB_BUILD_SHARED) ENDIF(JSONCPP_LIB_BUILD_SHARED) +if( CMAKE_COMPILER_IS_GNUCXX ) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=strict-aliasing") +endif( CMAKE_COMPILER_IS_GNUCXX ) + SET( JSONCPP_INCLUDE_DIR ../../include ) SET( PUBLIC_HEADERS diff --git a/src/lib_json/json_value.cpp b/src/lib_json/json_value.cpp index 0010f6f5e..637016f3b 100644 --- a/src/lib_json/json_value.cpp +++ b/src/lib_json/json_value.cpp @@ -34,7 +34,8 @@ namespace Json { #define ALIGNAS(byte_alignment) #endif static const unsigned char ALIGNAS(8) kNull[sizeof(Value)] = {0}; -const Value& Value::null = reinterpret_cast(kNull); +const unsigned char& kNullRef = kNull[0]; +const Value& Value::null = reinterpret_cast(kNullRef); const Int Value::minInt = Int(~(UInt(-1) / 2)); const Int Value::maxInt = Int(UInt(-1) / 2);