1

I am porting the project to compile with 4.2 compare to 3.4.6

I get the error while compiling following code in gcc 4.2 whereas it works fine in gcc3.4.6 error: invalid application of ‘sizeof’ to incomplete type ‘boost::STATIC_ASSERTION_FAILURE’

I tried using BOOST_MPL_ASSERT but wasn't successful.

template< uint64_t N , class T >
    struct count
    {
        BOOST_STATIC_ASSERT( _to_bool_< typename _is_integer_<T>::value >::VALUE == true );
        //BOOST_MPL_ASSERT( ( bool_< _to_bool_< typename _is_integer_<T>::value >::VALUE == true > ) );

        static
        uint64_t compute( T const & p_arg ) {
            enum { VALUE = (  N >> 1 ),
                   MASK  = ( ( ( 1UL << VALUE ) - 1 )  ) } ;


            return   count < VALUE, T >::compute( MASK & ( p_arg >> VALUE ) )
                   + count < VALUE, T >::compute( p_arg & MASK  );
        }
    };

Lines of code causing error

if( count< static_cast< uint64_t >( 64 ), uint64_t >::compute( p_max_block_size ) > 1 ) {
                    set_fail_bit();
                    return 0;
                }
rkb
  • 10,933
  • 22
  • 76
  • 103
  • You need to show the full program, we don't know what `T` is and cannot test the code ourselves (Also gcc 3.4.6 is quite old). – Jesse Good Feb 01 '13 at 22:24
  • I know 3.4.6 is old thats why I am trying to edit the project to make it build with 4.2; I have modified the question to show the line of code causing the issue. – rkb Feb 01 '13 at 22:43
  • 1
    I don't know what is `_is_integer_` or `_to_bool_`. Here is a minimal [test case](http://liveworkspace.org/code/4bXt1J$11) with `boost::is_integral` that works. Also, you shouldn't need `typename` before `_is_integer_::value` because it is a non-type. – Jesse Good Feb 01 '13 at 22:59

0 Answers0