Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2007-03-04 22:21:18


shunsuke wrote:
> Hi,
>
> CVS HEAD can't compile this under maybe any conforming compiler.
> (RC_1_34 is ok.)
>
>
> #include <boost/utility/result_of.hpp>
>
> int my_fun(int) { return 0; }
>
> template< class F >
> void test(F )
> {
> typedef typename
> boost::result_of<F()>::type
> result_t; // shall be 'void'.
> }
>
> int main()
> {
> ::test(&my_fun);
> }
>
>
> Specializations are not enough?

I'm a bit confused. The type of F is int(*)(int). You're asking what the
return type is if you call it with no parameters. But you can't do that!
It takes an int. result_of<F(int)>::type compiles fine. I'm not sure
this is a bug. Can you justify why you think this code should compile?

-- 
Eric Niebler
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