[type_traits] possible regression on is_function trait

Hi, I don't know if this is a regression on Boost.TypeTraits or if I'm using incorrectly the is_function trait. John, could you confirm there is a bug in is_function? Best, Vicente Test output: Sandia-darwin-4.4 - thread - async__async_p / darwin-4.4 Rev 81191 / Mon, 5 Nov 2012 06:30:00 +0000 *Report Time: *Mon, 5 Nov 2012 14:19:58 +0000 Compile [2012-11-05 07:50:44 UTC]: fail "/opt/local/bin/g++-mp-4.4" -ftemplate-depth-128 -O0 -fno-inline -Wall -pedantic -g -dynamic -gdwarf-2 -fexceptions -fPIC -Wextra -Wno-long-long -fpermissive -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_CHRONO_DYN_LINK=1 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_THREAD_BUILD_DLL=1 -DBOOST_THREAD_POSIX -DBOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED -DBOOST_THREAD_USE_DLL=1 -I".." -c -o "/Volumes/scratch/kbelco/boost/results/boost/bin.v2/libs/thread/test/async__async_p.test/darwin-4.4/debug/threading-multi/sync/futures/async/async_pass.o" "../libs/thread/test/sync/futures/async/async_pass.cpp" In file included from ../boost/type_traits/is_convertible.hpp:28, from ../boost/thread/detail/move.hpp:13, from ../boost/thread/future.hpp:20, from ../libs/thread/test/sync/futures/async/async_pass.cpp:28: ../boost/type_traits/is_function.hpp: In instantiation of 'boost::detail::is_function_chooser<false>::result_<boost::rv<boost::rv<boost::packaged_task<int()> > >&>': ../boost/type_traits/is_function.hpp:60: instantiated from 'boost::detail::is_function_impl<boost::rv<boost::rv<boost::packaged_task<int()> > >&>' ../boost/type_traits/is_function.hpp:102: instantiated from 'boost::is_function<boost::rv<boost::rv<boost::packaged_task<int()> > >&>' ../boost/type_traits/is_convertible.hpp:354: instantiated from 'const bool boost::detail::is_convertible_impl<boost::rv<boost::packaged_task<int()> >&, boost::rv<boost::rv<boost::packaged_task<int()> > >&>::value' ../boost/type_traits/is_convertible.hpp:480: instantiated from 'boost::is_convertible<boost::rv<boost::packaged_task<int()> >&, boost::rv<boost::rv<boost::packaged_task<int()> > >&>' ../boost/thread/future.hpp:2717: instantiated from 'boost::future<T> boost::async(boost::launch, R (*)()) [with R = int]' ../libs/thread/test/sync/futures/async/async_pass.cpp:117: instantiated from here ../boost/type_traits/is_function.hpp:52: error: forming pointer to reference type 'boost::rv<boost::rv<boost::packaged_task<int()> > >&'

Le 05/11/12 18:26, Vicente J. Botet Escriba a écrit :
Hi,
I don't know if this is a regression on Boost.TypeTraits or if I'm using incorrectly the is_function trait.
John, could you confirm there is a bug in is_function?
Best, Vicente
Test output: Sandia-darwin-4.4 - thread - async__async_p / darwin-4.4 Rev 81191 / Mon, 5 Nov 2012 06:30:00 +0000 *Report Time: *Mon, 5 Nov 2012 14:19:58 +0000 Compile [2012-11-05 07:50:44 UTC]: fail
"/opt/local/bin/g++-mp-4.4" -ftemplate-depth-128 -O0 -fno-inline -Wall -pedantic -g -dynamic -gdwarf-2 -fexceptions -fPIC -Wextra -Wno-long-long -fpermissive -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_CHRONO_DYN_LINK=1 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_THREAD_BUILD_DLL=1 -DBOOST_THREAD_POSIX -DBOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED -DBOOST_THREAD_USE_DLL=1 -I".." -c -o "/Volumes/scratch/kbelco/boost/results/boost/bin.v2/libs/thread/test/async__async_p.test/darwin-4.4/debug/threading-multi/sync/futures/async/async_pass.o" "../libs/thread/test/sync/futures/async/async_pass.cpp"
In file included from ../boost/type_traits/is_convertible.hpp:28, from ../boost/thread/detail/move.hpp:13, from ../boost/thread/future.hpp:20, from ../libs/thread/test/sync/futures/async/async_pass.cpp:28: ../boost/type_traits/is_function.hpp: In instantiation of 'boost::detail::is_function_chooser<false>::result_<boost::rv<boost::rv<boost::packaged_task<int()>
&>': ../boost/type_traits/is_function.hpp:60: instantiated from 'boost::detail::is_function_impl<boost::rv<boost::rv<boost::packaged_task<int()> &>' ../boost/type_traits/is_function.hpp:102: instantiated from 'boost::is_function<boost::rv<boost::rv<boost::packaged_task<int()> > &>' ../boost/type_traits/is_convertible.hpp:354: instantiated from 'const bool boost::detail::is_convertible_impl<boost::rv<boost::packaged_task<int()> &, boost::rv<boost::rv<boost::packaged_task<int()> > >&>::value' ../boost/type_traits/is_convertible.hpp:480: instantiated from 'boost::is_convertible<boost::rv<boost::packaged_task<int()> >&, boost::rv<boost::rv<boost::packaged_task<int()> > >&>' ../boost/thread/future.hpp:2717: instantiated from 'boost::future<T> boost::async(boost::launch, R (*)()) [with R = int]' ../libs/thread/test/sync/futures/async/async_pass.cpp:117: instantiated from here ../boost/type_traits/is_function.hpp:52: error: forming pointer to reference type 'boost::rv<boost::rv<boost::packaged_task<int()> > >&'
I don't know what is going wrong, but the instantiation seems to think that boost::rv<boost::rv<boost::packaged_task<int()> > >& is not a reference. Could someone check this? Thanks, Vicente template<bool is_ref = true> struct is_function_chooser : public ::boost::type_traits::false_result { }; template <> struct is_function_chooser<false> { template< typename T > struct result_ : public ::boost::type_traits::is_function_ptr_helper<T*> { //line 52 }; }; template <typename T> struct is_function_impl : public is_function_chooser< ::boost::is_reference<T>::value > ::BOOST_NESTED_TEMPLATE result_<T> { //line 60 };

On Mon, Nov 5, 2012 at 9:56 AM, Vicente J. Botet Escriba < vicente.botet@wanadoo.fr> wrote:
Le 05/11/12 18:26, Vicente J. Botet Escriba a écrit :
Hi,
I don't know if this is a regression on Boost.TypeTraits or if I'm using incorrectly the is_function trait.
John, could you confirm there is a bug in is_function?
Best, Vicente
Test output: Sandia-darwin-4.4 - thread - async__async_p / darwin-4.4 Rev 81191 / Mon, 5 Nov 2012 06:30:00 +0000 *Report Time: *Mon, 5 Nov 2012 14:19:58 +0000 Compile [2012-11-05 07:50:44 UTC]: fail
"/opt/local/bin/g++-mp-4.4" -ftemplate-depth-128 -O0 -fno-inline -Wall -pedantic -g -dynamic -gdwarf-2 -fexceptions -fPIC -Wextra -Wno-long-long -fpermissive -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_CHRONO_DYN_LINK=1 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_THREAD_BUILD_DLL=1 -DBOOST_THREAD_POSIX -DBOOST_THREAD_THROW_IF_**PRECONDITION_NOT_SATISFIED -DBOOST_THREAD_USE_DLL=1 -I".." -c -o "/Volumes/scratch/kbelco/** boost/results/boost/bin.v2/**libs/thread/test/async__async_** p.test/darwin-4.4/debug/**threading-multi/sync/futures/**async/async_pass.o" "../libs/thread/test/sync/**futures/async/async_pass.cpp"
In file included from ../boost/type_traits/is_**convertible.hpp:28, from ../boost/thread/detail/move.**hpp:13, from ../boost/thread/future.hpp:20, from ../libs/thread/test/sync/** futures/async/async_pass.cpp:**28: ../boost/type_traits/is_**function.hpp: In instantiation of 'boost::detail::is_function_**chooser<false>::result_<boost:** :rv<boost::rv<boost::packaged_**task<int()> > >&>': ../boost/type_traits/is_**function.hpp:60: instantiated from 'boost::detail::is_function_**impl<boost::rv<boost::rv<**boost::packaged_task<int()>
&>' ../boost/type_traits/is_**function.hpp:102: instantiated from 'boost::is_function<boost::rv<**boost::rv<boost::packaged_**task<int()> &>' ../boost/type_traits/is_**convertible.hpp:354: instantiated from 'const bool boost::detail::is_convertible_**impl<boost::rv<boost::**packaged_task<int()> &, boost::rv<boost::rv<boost::**packaged_task<int()> > >&>::value' ../boost/type_traits/is_**convertible.hpp:480: instantiated from 'boost::is_convertible<boost::**rv<boost::packaged_task<int()> >&, boost::rv<boost::rv<boost::**packaged_task<int()> > >&>' ../boost/thread/future.hpp:**2717: instantiated from 'boost::future<T> boost::async(boost::launch, R (*)()) [with R = int]' ../libs/thread/test/sync/**futures/async/async_pass.cpp:**117: instantiated from here ../boost/type_traits/is_**function.hpp:52: error: forming pointer to reference type 'boost::rv<boost::rv<boost::**packaged_task<int()> > >&'
I don't know what is going wrong, but the instantiation seems to think that boost::rv<boost::rv<boost::**packaged_task<int()> > >& is not a reference.
Red flag seeing boost::rv< boost::rv< ... > > :/ Aside from that, looks strange; is this the only tester with an issue?
Could someone check this?
Thanks, Vicente
template<bool is_ref = true> struct is_function_chooser : public ::boost::type_traits::false_**result { };
template <> struct is_function_chooser<false> { template< typename T > struct result_ : public ::boost::type_traits::is_**function_ptr_helper<T*> { //line 52 }; };
template <typename T> struct is_function_impl : public is_function_chooser< ::boost::is_reference<T>::**value > ::BOOST_NESTED_TEMPLATE result_<T> { //line 60 };
- Jeff

On Mon, Nov 5, 2012 at 9:56 AM, Vicente J. Botet Escriba < vicente.botet@wanadoo.fr> wrote:
Le 05/11/12 18:26, Vicente J. Botet Escriba a écrit :
Hi,
I don't know if this is a regression on Boost.TypeTraits or if I'm using incorrectly the is_function trait.
John, could you confirm there is a bug in is_function?
Best, Vicente
I don't know what is going wrong, but the instantiation seems to think that boost::rv<boost::rv<boost::**packaged_task<int()> > >& is not a reference.
Red flag seeing boost::rv< boost::rv< ... > > :/ Yes this was suspecting,but I have not taken the time to identify where
Le 06/11/12 04:40, Jeffrey Lee Hellrung, Jr. a écrit : this is_convertible comes from. I don't know if the need for this workaround is hiding a bad design on the move semantics emulation I'm using in Boost.Thread. I will analyze it tis evening.
Aside from that, looks strange; is this the only tester with an issue?
Yes I think it is the only one Vicente

I don't know if this is a regression on Boost.TypeTraits or if I'm using incorrectly the is_function trait.
Ideally it shouldn't be possible to use it incorrectly, which isn't to say that there aren't corner cases...
John, could you confirm there is a bug in is_function?
If the failure is specific to one test runner, then I suspect a compiler bug: do you have a reduced test case I can look at? John.
Test output: Sandia-darwin-4.4 - thread - async__async_p / darwin-4.4 Rev 81191 / Mon, 5 Nov 2012 06:30:00 +0000 *Report Time: *Mon, 5 Nov 2012 14:19:58 +0000 Compile [2012-11-05 07:50:44 UTC]: fail
"/opt/local/bin/g++-mp-4.4" -ftemplate-depth-128 -O0 -fno-inline -Wall -pedantic -g -dynamic -gdwarf-2 -fexceptions -fPIC -Wextra -Wno-long-long -fpermissive -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_CHRONO_DYN_LINK=1 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_THREAD_BUILD_DLL=1 -DBOOST_THREAD_POSIX -DBOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED -DBOOST_THREAD_USE_DLL=1 -I".." -c -o "/Volumes/scratch/kbelco/boost/results/boost/bin.v2/libs/thread/test/async__async_p.test/darwin-4.4/debug/threading-multi/sync/futures/async/async_pass.o" "../libs/thread/test/sync/futures/async/async_pass.cpp"
In file included from ../boost/type_traits/is_convertible.hpp:28, from ../boost/thread/detail/move.hpp:13, from ../boost/thread/future.hpp:20, from ../libs/thread/test/sync/futures/async/async_pass.cpp:28: ../boost/type_traits/is_function.hpp: In instantiation of 'boost::detail::is_function_chooser<false>::result_<boost::rv<boost::rv<boost::packaged_task<int()>
&>': ../boost/type_traits/is_function.hpp:60: instantiated from 'boost::detail::is_function_impl<boost::rv<boost::rv<boost::packaged_task<int()> &>' ../boost/type_traits/is_function.hpp:102: instantiated from 'boost::is_function<boost::rv<boost::rv<boost::packaged_task<int()> > >&>' ../boost/type_traits/is_convertible.hpp:354: instantiated from 'const bool boost::detail::is_convertible_impl<boost::rv<boost::packaged_task<int()> &, boost::rv<boost::rv<boost::packaged_task<int()> > >&>::value' ../boost/type_traits/is_convertible.hpp:480: instantiated from 'boost::is_convertible<boost::rv<boost::packaged_task<int()> >&, boost::rv<boost::rv<boost::packaged_task<int()> > >&>' ../boost/thread/future.hpp:2717: instantiated from 'boost::future<T> boost::async(boost::launch, R (*)()) [with R = int]' ../libs/thread/test/sync/futures/async/async_pass.cpp:117: instantiated from here ../boost/type_traits/is_function.hpp:52: error: forming pointer to reference type 'boost::rv<boost::rv<boost::packaged_task<int()> > >&'
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Le 06/11/12 09:53, John Maddock a écrit :
I don't know if this is a regression on Boost.TypeTraits or if I'm using incorrectly the is_function trait.
Ideally it shouldn't be possible to use it incorrectly, which isn't to say that there aren't corner cases...
John, could you confirm there is a bug in is_function?
If the failure is specific to one test runner, then I suspect a compiler bug: do you have a reduced test case I can look at?
Hi, I don't reach to isolate the error. The following compiles as expected :( Best, Vicente #define BOOST_THREAD_VERSION 4 #include <boost/thread/future.hpp> #include <boost/static_assert.hpp> BOOST_STATIC_ASSERT(boost::is_function<int&>::value == false); BOOST_STATIC_ASSERT(( boost::is_function<boost::packaged_task<int()> &>::value == false )); BOOST_STATIC_ASSERT(( boost::is_function<boost::rv<boost::packaged_task<int()> >&>::value == false )); BOOST_STATIC_ASSERT(( boost::is_function<boost::rv<boost::rv<boost::packaged_task<int()> >
&>::value == false )); BOOST_STATIC_ASSERT(( boost::is_convertible< boost::rv<boost::packaged_task<int()> >&, boost::rv<boost::rv<boost::packaged_task<int()> > >& >::value == false )); BOOST_STATIC_ASSERT(( boost::detail::is_convertible_impl< boost::rv<boost::packaged_task<int()> >&, boost::rv<boost::rv<boost::packaged_task<int()> > >& >::value == false ));
int h() { return 0; } struct dummy1; template <class F> int apply(F f, typename boost::disable_if_c< boost::is_convertible<F&,BOOST_THREAD_RV_REF(F)>::value, dummy1* >::type=0) { return f(); } template <class R> boost::future<R> my_async(R(*f)()) { boost::packaged_task<R()> pt( f ); boost::future<R> ret = pt.get_future(); boost::thread( boost::move(pt) ).detach(); return boost::move(ret); } int g() { return apply(h) + my_async(h).get(); }
participants (3)
-
Jeffrey Lee Hellrung, Jr.
-
John Maddock
-
Vicente J. Botet Escriba