Boost logo

Boost :

From: João Abecasis (jpabecasis_at_[hidden])
Date: 2006-05-29 18:35:34


While fixing some issues with fusion::unpack_args I noticed that
cv-qualified function pointers are not handled by result_of and
type_traits::is_function doesn't handle cv-qualified functions.

Here's a simple test case for result_of:

     #include <boost/utility/result_of.hpp>
     typedef int (* const c_func_ptr)(int);
     typedef boost::result_of<c_func_ptr(int)>::type return_type;

and a slightly more convoluted for type_traits::is_pointer:

     #include <boost/type_traits/is_function.hpp>
     #include <boost/static_assert.hpp>

     void foo ();

     template <class F>
     void bar(F &)
         BOOST_STATIC_ASSERT(boost::is_function<F const>::value);

     template <class F>
     void baz(F const & f)

     int main()

Both failing with gcc-4.x. The first test case also fails with
gcc-3.2.3. while the second case fails for a completely different reason
in overload resolution.

For unpack_args I worked around these issues by applying remove_cv to
pointers in general and also before testing with is_function. In either
case cv-qualification shouldn't affect the type of the arguments or the
result, which is what I'm interested in.

Anyway I'm thinking that the solution could be moved upstream so others
won't stumble upon the same issues. Thoughts?

Best regards,


Boost list run by bdawes at, gregod at, cpdaniel at, john at