|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2003-12-03 11:42:27
Douglas Paul Gregor <gregod_at_[hidden]> writes:
> On Wed, 3 Dec 2003, David Abrahams wrote:
>
>>
>> The following test is failing for me:
>>
>> ====== BEGIN OUTPUT ======
>> Platform: Cygwin
>> Compiler: GNU C++ version 2.95.3-10 (cygwin special)
>> STL : SGI standard library
>> Boost : 1.31.0
>> Running 1 test case...
>> c
>> ../../../libs/type_traits/test/type_with_alignment_test.cpp(151): error in "type_with_alignment": test ::tt::is_pod< ::tt::type_with_alignment< ::tt::alignment_of<long double>::value>::type >::value failed
>>
>> Test suite "Type Traits" failed with:
>> 35 assertions out of 36 passed
>> 1 assertion out of 36 failed
>>
>> Test case "type_with_alignment" failed with:
>> 35 assertions out of 36 passed
>> 1 assertion out of 36 failed
>> ====== END OUTPUT ======
>>
>> My question: what gives us the right to expect that is_pod will
>> return true in this case, since is_pod only works with compiler
>> support?
>
> type_with_alignment is supposed to give back a POD type. When we create
> other types in type_with_alignment that may be returned (say, the aligned
> structs for the GCC-specific version), we should be marking them POD via
> BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,...,true).
Obviously you didn't include all the possible numbers:
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::max_align,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::lower_alignment<1> ,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::lower_alignment<2> ,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::lower_alignment<4> ,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::lower_alignment<8> ,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::lower_alignment<10> ,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::lower_alignment<16> ,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::lower_alignment<32> ,true)
Why not just use a partial specialization where it's available?
> I did this for GCC (so I find it odd it's broken there)
It's only broken with gcc-2.95.x and maybe only on Cygwin.
> , but it needs to be done elsewhere as well.
-- 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