Boost logo

Boost :

From: Daniel Frey (d.frey_at_[hidden])
Date: 2003-02-16 16:53:46


On Sun, 16 Feb 2003 12:45:30 +0100, John Maddock wrote:

>> typedef char t8[ test::is_convertible< double, int >::value ];
>
> That one issues a warning: for other compilers we are able to suppress
> that, if you have any ideas on how to do so with gcc I'd be happy to
> hear about it.

After looking into the code I'm confused. There is code which reads:

#if defined(__GNUC__)

// Declare specializations of is_convertible for all of the floating
// types to all of the integral types. This suppresses some nasty
// warnings

# define TT_AUX_IS_CONVERTIBLE_SPEC(T1,T2) \
    BOOST_TT_AUX_BOOL_TRAIT_SPEC2(is_convertible,T1,T2,true) \
    /**/

# define TT_AUX_IS_CONVERTIBLE_SPEC_2(T1,T2) \
    TT_AUX_IS_CONVERTIBLE_SPEC(T1,signed T2) \
    TT_AUX_IS_CONVERTIBLE_SPEC(T1,unsigned T2) \
    /**/

# define TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_SPEC(F) \
    TT_AUX_IS_CONVERTIBLE_SPEC(F,char) \
    TT_AUX_IS_CONVERTIBLE_SPEC_2(F,char) \
    TT_AUX_IS_CONVERTIBLE_SPEC_2(F,short) \
    TT_AUX_IS_CONVERTIBLE_SPEC_2(F,int) \
    TT_AUX_IS_CONVERTIBLE_SPEC_2(F,long) \
    TT_AUX_IS_CONVERTIBLE_SPEC_2(F,long long) \
    /**/

# define TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_CV_SPEC(F) \
    TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_SPEC(F const) \
    TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_SPEC(F volatile) \
    TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_SPEC(F const volatile) \
    /**/

TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_CV_SPEC(float)
TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_CV_SPEC(double)
TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_CV_SPEC(long double)

# undef TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_CV_SPEC
# undef TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_SPEC
# undef TT_AUX_IS_CONVERTIBLE_SPEC_2
# undef TT_AUX_IS_CONVERTIBLE_SPEC

#endif // __GNUC__

If it works, the warning shouldn't be there. But it is. And if the above
doesn't work, well, why is it included then? Before I don't understand
this, I will not try to fiddle with the code in is_convertible...

Regards, Daniel


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