Boost logo

Boost :

Subject: [boost] boost::aligned_storage broken on VC12 for alignment values of 8
From: Glen Fernandes (glen.fernandes_at_[hidden])
Date: 2014-03-30 02:41:10


Very surprising, but easily reproducible with VC12 (2013), Release or
Debug configuration, Win32 platform: the following program will often*
throw:

    #include <boost/type_traits/aligned_storage.hpp>
    #include <cstdint>
    int main()
    {
        boost::aligned_storage<8, 8>::type a;
        if (((std::uintptr_t)&a % 8) != 0) {
            throw 1;
        }
    }

* Four of every five times it failed because the storage was only
4-byte aligned, not 8-byte aligned.

Does not reproduce for x64 builds, just x86 builds. Does not reproduce
with alignment values other than 8.

Glen


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk