Skip to content

Commit

Permalink
Merge pull request #80 from codablock/pr_mingw32_extra_size
Browse files Browse the repository at this point in the history
Fix debug_size_heap::extra_size to always be 8 on MinGW 32bit builds
  • Loading branch information
arximboldi authored Apr 1, 2019
2 parents 6c6b8f4 + 7d39226 commit a844dca
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions immer/heap/debug_size_heap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,18 @@ namespace immer {
template <typename Base>
struct debug_size_heap
{
#if defined(__MINGW32__) && !defined(__MINGW64__)
// There is a bug in MinGW 32bit: https://sourceforge.net/p/mingw-w64/bugs/778/
// It causes different versions of std::max_align_t to be defined, depending on inclusion order of stddef.h
// and stdint.h. As we have no control over the inclusion order here (as it might be set in stone by the outside
// world), we can't easily pin it to one of both versions of std::max_align_t. This means, we have to hardcode
// extra_size for MinGW 32bit builds until the mentioned bug is fixed.
constexpr static auto extra_size = 8;
#else
constexpr static auto extra_size = sizeof(
std::aligned_storage_t<sizeof(std::size_t),
alignof(std::max_align_t)>);
#endif

template <typename... Tags>
static void* allocate(std::size_t size, Tags... tags)
Expand Down

0 comments on commit a844dca

Please sign in to comment.