Hello,
I'm running into a problem when using boost::result_of with gcc 3.4.2
and 4.2.1 (with MingW).
The following program compiles fine with Visual C++ 8.0, but not with gcc:
-------------------------------
#include
struct test_function1
{
template <typename SignatureT>
struct result;
template <typename T>
struct result
{
typedef T type;
};
template <typename T>
T operator () (T t) const
{
return t;
}
};
template <typename ArgT>
struct test_function2
{
template <typename SignatureT>
struct result;
template <typename T>
struct result
{
typedef T type;
};
template <typename T>
T operator () (T t) const
{
return t;
}
};
int main(int argc, char *argv[])
{
typedef boost::result_of<
test_function1(int)>::type result_type;
typedef boost::result_of<
test_function2<float>(int)>::type result_type;
return 0;
}
-------------------------------
The error message I get is for the second typedef using test_function2:
E:/Projects/Third Party/boost/boost/utility/result_of.hpp: In
instantiation of
`boost::detail::result_of_nested_result':
E:/Projects/Third Party/boost/boost/utility/result_of.hpp:75:
instantiated from
`boost::detail::result_of_impl'
E:/Projects/Third
Party/boost/boost/utility/detail/result_of_iterate.hpp:24:
instantiated from `boost::result_of'
main.cpp:43: instantiated from here
E:/Projects/Third Party/boost/boost/utility/result_of.hpp:68: error:
invalid use of undefined type `struct
test_function2<float>::result'
I get the same error if I simply wrap test_function1 in another
template class as nested struct and then use it instead of test_function2.
Am I attempting to do something fundamentally wrong here, or is it a
bug in gcc?
Thanks,
Martin