
Eric Niebler wrote:
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?
AFAIK, nullary instantiations of 'result_of' must always succeed; for function forwarding. See the Rationale at http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1454.html According to 20.5.4, I was slightly wrong. 'result_t' shall be 'int'? (I'm sure nobody cares, though.) Regards, -- Shunsuke Sogame