diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 72cab1f..cac51a5 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -424,7 +424,8 @@ PUGI__NS_BEGIN #define PUGI__GETPAGE_IMPL(header) (header).get_page() #else #define PUGI__GETHEADER_IMPL(object, page, flags) (((reinterpret_cast(object) - reinterpret_cast(page)) << 8) | (flags)) - #define PUGI__GETPAGE_IMPL(header) const_cast(reinterpret_cast(reinterpret_cast(&header) - (header >> 8))) + // this macro casts pointers through void* to avoid 'cast increases required alignment of target type' warnings + #define PUGI__GETPAGE_IMPL(header) static_cast(const_cast(static_cast(reinterpret_cast(&header) - (header >> 8)))) #endif #define PUGI__GETPAGE(n) PUGI__GETPAGE_IMPL((n)->header)