Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-10-26 07:18:10


Michael Shepanski <mshepanski_at_[hidden]> writes:

> The code below fails a compile-time assertion in boost 1.32.0 on MSVC 7.1.
>
> This is because, internally, boost::optional uses boost::alignment_of, which
> produces the number 12, which is then passed as a template parameter to
> boost::type_with_alignment, which won't accept 12.
> Not sure where the blame lies. Is it with boost::alignment_of, for
> producing
> 12 in the first place? Perhaps not, since 12 is a multiple of 4, and the
> doco
> says boost::alignment_of is allowed to produce any multiple of the actual
> alignment value. So is the fault with boost::type_with_alignment, for not
> accepting 12? Or is there something wrong with the app?

I think the problem is that type_with_alignment can't find a type that
has an alignment of 12. Producing an error in that case is the right
behavior. We could add the type whose alignment_of<> is 12 to the
reperotoire of types being tested by type_with_alignment...

> #include <boost/optional.hpp>
>
> class D
> {
> virtual ~D();
> };
>
> class E : virtual public D
> {
> virtual ~E();
> unsigned long long m_i;
> };
>
> boost::optional<E> s_optE;
>
> Cheers,
> --- Michael Shepanski
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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