|
Boost : |
From: John Maddock (jm_at_[hidden])
Date: 2002-08-24 05:47:42
> I think the problem is that, inside the
"is_member_function_pointer_select"
> template, the compiler no longer accepts the use of the return value of a
> function inside the static initialiser.
>
> BOOST_STATIC_CONSTANT(
> bool, value = (1 ==
> sizeof(detail::is_member_function_pointer_helper(make_t()))) );
>
> I have temporarily fixed this by changing the above to
>
> enum { value = (1 ==
> sizeof(detail::is_member_function_pointer_helper(make_t()))) };
>
> which the compiler accepts. After testing, I found that anything like
>
> template <class T>
> struct X
> {
> static T& f();
> static const int value = sizeof(f());
> };
>
> will not compile, whether or not instantiated.
OK I've been able to patch is_member_function_pointer for Borland by using a
static variable rather than a function - using this I was able to retain the
use of BOOST_STATIC_CONSTANT - in the past I've found that while enum's may
compile with Borland C++ they usually end up having indeterminant values if
used in integral constant expressions.
> I came across this while messing with Boost Python v2, using the recently
> patched version of the CBuilder 6 compiler (0x562). So it looks like there
> may be some significant changes for 0x562 and 0x570 (hopefully some bug
> fixes as well as new bugs).
I haven't noticed any fixes that effect boost, although Kylix does at least
support long long (and in integral constant expressions as well!).
John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/index.htm
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk