[type_traits][cw] is_convertible compile failure

Hello, The following legal snippet #include <boost/type_traits/is_convertible.hpp> #include <memory> class foo{}; typedef boost::is_convertible< const std::auto_ptr<const foo *>, const foo> type; int main() { bool b=type::value; } makes CW 9.x and 10.0 to fail with the following message (thanks to Noel Belcourt for his help in getting this): Error : function call '[std::auto_ptr<const foo *>].auto_ptr({lval} const std::auto_ptr<const foo *>)' does not match 'std::auto_ptr<const foo *>::auto_ptr(const foo **) throw()' (explicit) 'std::auto_ptr<const foo *>::auto_ptr(std::auto_ptr<const foo *> &) throw()' 'std::auto_ptr<const foo *>::auto_ptr<typename __T0>(std::auto_ptr<__T1_0> &) throw()' 'std::auto_ptr<const foo *>::auto_ptr(std::auto_ptr_ref<const foo *>) throw()' (point of instantiation: 'main()') (instantiating: 'boost::is_convertible<const std::auto_ptr<const foo *>, const foo>') (instantiating: 'boost::detail::is_convertible_impl_dispatch<const std::auto_ptr<const foo *>, const foo>') (instantiating: 'boost::detail::is_convertible_impl<const std::auto_ptr<const foo *>, const foo>') (instantiating: 'boost::detail::is_convertible_basic_impl<const std::auto_ptr<const foo *> &, const foo>') is_convertible.hpp line 204 ); (corresponding point of instantiation for 'boost::detail::is_convertible_basic_impl<const std::auto_ptr<const foo *> &, const foo>') is_convertible.hpp line 235 ); (corresponding point of instantiation for 'boost::detail::is_convertible_impl<const std::auto_ptr<const foo *>, const foo>') is_convertible.hpp line 301 : public is_convertible_impl_dispatch_base<From, To>::type (corresponding point of instantiation for 'boost::detail::is_convertible_impl_dispatch<const std::auto_ptr<const foo *>, const foo>') is_convertible.hpp line 348 BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_convertible,From,To,(::boost::detail:: is_convertible_impl_dispatch<From,To>::value)) (corresponding point of instantiation for 'boost::is_convertible<const std::auto_ptr<const foo *>, const foo>') is_convertible.cpp line 12 bool b=type::value; Is there anything that can be done in boost::is_convertible to workaround this problem? I've inspected the code and seems like there's a variety of implementation methods to choose from, but being a complete stranger to Boost.TypeTraits I can't help much :( Thank you, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

Is there anything that can be done in boost::is_convertible to workaround this problem? I've inspected the code and seems like there's a variety of implementation methods to choose from, but being a complete stranger to Boost.TypeTraits I can't help much :(
I have an idea, but it may cause other breakages :-( I think the problem is highlighted by the comment in the code for the version used by MWCW: // This version seems to work pretty well for a wide spectrum of compilers, // however it does rely on undefined behaviour by passing UDT's through (...). The problem is that since the From type is not convertible to the To type, it tries to pass it through (...) which fails in case because auto_ptr is not copy-constructible in the classic sense of the word. Try enabling the branch that begins: #elif (defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 245) && !defined(__ICL)) \ || defined(__IBMCPP__) || defined(__HP_aCC) For MWCW and see if the type_traits regresion tests still pass, and if it fixes this issue. Unfortunately I suspect there may be a reason why this pp-branch wasn't enabled for MWCW. HTH, John.

John Maddock wrote:
The problem is that since the From type is not convertible to the To type, it tries to pass it through (...) which fails in case because auto_ptr is not copy-constructible in the classic sense of the word.
Try enabling the branch that begins:
#elif (defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 245) && !defined(__ICL)) \ || defined(__IBMCPP__) || defined(__HP_aCC)
For MWCW and see if the type_traits regresion tests still pass, and if it fixes this issue. Unfortunately I suspect there may be a reason why this pp-branch wasn't enabled for MWCW.
Works fine with __MWERKS__ - at least for this example. Shall I apply it? I may break other things which we'll hopefully see in the regression tests... Stefan

Stefan Slapeta ha escrito:
Stefan Slapeta wrote:
Works fine with __MWERKS__ - at least for this example. Shall I apply it? I may break other things which we'll hopefully see in the regression tests...
BTW, it doesn't break is_convertible_test, at least :-)
stefan
Unless John's suspicions about a reason for CW not adopting the EDG pp-branch get concrete, I'd say applying the change to the CVS is our best option. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

John Maddock wrote:
Could you please run the complete type traits tests, and if there are no new regressions then go ahead and commit?
:-( stefan MkDir1 ..\..\..\bin\boost\libs\type_traits\test\tricky_function_type_test.test mkdir "..\..\..\bin\boost\libs\type_traits\test\tricky_function_type_test.test" MkDir1 ..\..\..\bin\boost\libs\type_traits\test\tricky_function_type_test.test\cw-9_4 mkdir "..\..\..\bin\boost\libs\type_traits\test\tricky_function_type_test.test\cw-9_4" MkDir1 ..\..\..\bin\boost\libs\type_traits\test\tricky_function_type_test.test\cw-9_4\debug mkdir "..\..\..\bin\boost\libs\type_traits\test\tricky_function_type_test.test\cw-9_4\debug" MkDir1 ..\..\..\bin\boost\libs\type_traits\test\tricky_function_type_test.test\cw-9_4\debug\threading-multi mkdir "..\..\..\bin\boost\libs\type_traits\test\tricky_function_type_test.test\cw-9_4\debug\threading-multi" cw-C++-action ..\..\..\bin\boost\libs\type_traits\test\tricky_function_type_test.test\cw-9_4\debug\threading-multi\tricky_function_type_test.obj call "c:\Programme\Metrowerks\Codewarrior\Other Metrowerks Tools\Command Line Tools\cwenv.bat" -quiet set "ERRORLEVEL=" mwcc -c -lang c++ -maxerrors 5 -warnings on -maxwarnings 20 -nowraplines -g -O0 -inline off -cwd include -wchar_t on -warnings nounusedexpr,nounused -runtime dmd -RTTI on -iso_templates on "-I..\..\..\bin\boost\libs\type_traits\test" -I- "-IC:\views_cvs\boost" -o "..\..\..\bin\boost\libs\type_traits\test\tricky_function_type_test.test\cw-9_4\debug\threading-multi\tricky_function_type_test.obj" "C:\views_cvs\boost\libs\type_traits\test\tricky_function_type_test.cpp" ### mwcc Compiler: # In: ..\..\..\boost\type_traits\is_convertible.hpp # From: tricky_function_type_test.cpp # -------------------------------------- # 158: ); # Error: ^ # function call '_m_check({lval} void (), int)' does not match # 'boost::detail::is_convertible_basic_impl<void (&)(), boost::detail::int_convertible>::_m_check(boost::detail::any_conversion, ...)' (static) # 'boost::detail::is_convertible_basic_impl<void (&)(), boost::detail::int_convertible>::_m_check(boost::detail::int_convertible, int)' (static) # (point of instantiation: 'main()') # (instantiating: 'boost::is_enum<void ()>') # (instantiating: 'boost::detail::is_enum_impl<void ()>') # (instantiating: 'boost::detail::is_enum_helper<false>::type<void ()>') # (instantiating: 'boost::is_convertible<void (&)(), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_impl_dispatch<void (&)(), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_impl<void (&)(), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_basic_impl<void (&)(), boost::detail::int_convertible>') ### mwcc Compiler: # 158: ); # Error: ^ # function call '_m_check({lval} void (), int)' does not match # 'boost::detail::is_convertible_basic_impl<void (&)(), int>::_m_check(boost::detail::any_conversion, ...)' (static) # 'boost::detail::is_convertible_basic_impl<void (&)(), int>::_m_check(int, int)' (static) # (point of instantiation: 'main()') # (instantiating: 'boost::is_convertible<void (), int>') # (instantiating: 'boost::detail::is_convertible_impl_dispatch<void (), int>') # (instantiating: 'boost::detail::is_convertible_impl<void (), int>') # (instantiating: 'boost::detail::is_convertible_basic_impl<void (&)(), int>') ### mwcc Compiler: # 158: ); # Error: ^ # function call '_m_check({lval} void (int), int)' does not match # 'boost::detail::is_convertible_basic_impl<void (&)(int), boost::detail::int_convertible>::_m_check(boost::detail::any_conversion, ...)' (static) # 'boost::detail::is_convertible_basic_impl<void (&)(int), boost::detail::int_convertible>::_m_check(boost::detail::int_convertible, int)' (static) # (point of instantiation: 'main()') # (instantiating: 'boost::is_enum<void (int)>') # (instantiating: 'boost::detail::is_enum_impl<void (int)>') # (instantiating: 'boost::detail::is_enum_helper<false>::type<void (int)>') # (instantiating: 'boost::is_convertible<void (&)(int), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_impl_dispatch<void (&)(int), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_impl<void (&)(int), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_basic_impl<void (&)(int), boost::detail::int_convertible>') ### mwcc Compiler: # 158: ); # Error: ^ # function call '_m_check({lval} void (int &, double), int)' does not match # 'boost::detail::is_convertible_basic_impl<void (&)(int &, double), boost::detail::int_convertible>::_m_check(boost::detail::any_conversion, ...)' (static) # 'boost::detail::is_convertible_basic_impl<void (&)(int &, double), boost::detail::int_convertible>::_m_check(boost::detail::int_convertible, int)' (static) # (point of instantiation: 'main()') # (instantiating: 'boost::is_enum<void (int &, double)>') # (instantiating: 'boost::detail::is_enum_impl<void (int &, double)>') # (instantiating: 'boost::detail::is_enum_helper<false>::type<void (int &, double)>') # (instantiating: 'boost::is_convertible<void (&)(int &, double), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_impl_dispatch<void (&)(int &, double), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_impl<void (&)(int &, double), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_basic_impl<void (&)(int &, double), boost::detail::int_convertible>') ### mwcc Compiler: # 158: ); # Error: ^ # function call '_m_check({lval} void (int &, bool, int, int), int)' does not match # 'boost::detail::is_convertible_basic_impl<void (&)(int &, bool, int, int), boost::detail::int_convertible>::_m_check(boost::detail::any_conversion, ...)' (static) # 'boost::detail::is_convertible_basic_impl<void (&)(int &, bool, int, int), boost::detail::int_convertible>::_m_check(boost::detail::int_convertible, int)' (static) # (point of instantiation: 'main()') # (instantiating: 'boost::is_enum<void (int &, bool, int, int)>') # (instantiating: 'boost::detail::is_enum_impl<void (int &, bool, int, int)>') # (instantiating: 'boost::detail::is_enum_helper<false>::type<void (int &, bool, int, int)>') # (instantiating: 'boost::is_convertible<void (&)(int &, bool, int, int), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_impl_dispatch<void (&)(int &, bool, int, int), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_impl<void (&)(int &, bool, int, int), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_basic_impl<void (&)(int &, bool, int, int), boost::detail::int_convertible>') # Too many errors printed, aborting program ...failed cw-C++-action ..\..\..\bin\boost\libs\type_traits\test\tricky_function_type_test.test\cw-9_4\debug\threading-multi\tricky_function_type_test.obj... ...skipped <@boost!libs!type_traits!test\tricky_function_type_test.test\cw-9_4\debug\threading-multi>tricky_function_type_test.CMD for lack of <@boost!libs!type_traits!test\tricky_function_type_test.test\cw-9_4\debug\threading-multi>tricky_function_type_test.obj... ...skipped <@boost!libs!type_traits!test\tricky_function_type_test.test\cw-9_4\debug\threading-multi>tricky_function_type_test.exe for lack of <@boost!libs!type_traits!test\tricky_function_type_test.test\cw-9_4\debug\threading-multi>tricky_function_type_test.CMD...

### mwcc Compiler: # In: ..\..\..\boost\type_traits\is_convertible.hpp # From: tricky_function_type_test.cpp # -------------------------------------- # 158: ); # Error: ^ # function call '_m_check({lval} void (), int)' does not match # 'boost::detail::is_convertible_basic_impl<void (&)(), boost::detail::int_convertible>::_m_check(boost::detail::any_conversion, ...)' (static) # 'boost::detail::is_convertible_basic_impl<void (&)(), boost::detail::int_convertible>::_m_check(boost::detail::int_convertible, int)' (static) # (point of instantiation: 'main()') # (instantiating: 'boost::is_enum<void ()>') # (instantiating:
I don't see any way around that unfortunately: the function call should be deduced to work OK: it does on EDG and gcc compilers, and ultimately all the possible implementations use either this method or the current one (or trivial variations). Is there any other way to work around the original problem? John.

John Maddock wrote:
I don't see any way around that unfortunately: the function call should be deduced to work OK: it does on EDG and gcc compilers, and ultimately all the possible implementations use either this method or the current one (or trivial variations). Is there any other way to work around the original problem?
I don't see any, either, as CW seems not being able to handle function types at all here. I'm also far from being an expert :-) : the auto_ptr test works well with the original implementation if you remove const. I'm just wondering: could someone give me an example where is_convertible returns different results if a type is/is not const? stefan

Stefan Slapeta <stefan <at> slapeta.com> writes:
John Maddock wrote:
I don't see any way around that unfortunately: the function call should be deduced to work OK: it does on EDG and gcc compilers, and ultimately all
the
possible implementations use either this method or the current one (or trivial variations). Is there any other way to work around the original problem?
I don't see any, either, as CW seems not being able to handle function types at all here.
Have you tried my suggestion at a previous post before throwing in the towel? "...what happens if you change the second ctor of any_conversion (which is only to kick in for function references) from template <typename T> any_conversion(T&); to template <typename T> any_conversion(T);" Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

Joaquin M Lopez Munoz schrieb:
Have you tried my suggestion at a previous post before throwing in the towel?
I have, although I didn't think it could help. I also tried several other things, and maybe I'll play with it when I have a little bit more time :-) Stefan

I don't see any, either, as CW seems not being able to handle function types at all here.
I'm also far from being an expert :-) : the auto_ptr test works well with the original implementation if you remove const.
Which const?
I'm just wondering: could someone give me an example where is_convertible returns different results if a type is/is not const?
The only case I can think of is along the lines of: class foo { public: foo(bar&); }; is_convertible<bar,foo>::value should be true. is_convertible<const bar,foo>::value should be false. John.

John Maddock wrote:
Which const?
From-type. The compiler complained about the fact that there are only non-const-argument constructors in auto_ptr: Error : function call '[std::auto_ptr<const foo *>].auto_ptr({lval} const std::auto_ptr<const foo *>)' does not match 'std::auto_ptr<const foo *>::auto_ptr(const foo **) throw()' (explicit) 'std::auto_ptr<const foo *>::auto_ptr(std::auto_ptr<const foo *> &) throw()' 'std::auto_ptr<const foo *>::auto_ptr<typename __T0>(std::auto_ptr<__T1_0> &) throw()' 'std::auto_ptr<const foo *>::auto_ptr(std::auto_ptr_ref<const foo *>) throw()'
The only case I can think of is along the lines of:
class foo { public: foo(bar&); };
is_convertible<bar,foo>::value should be true. is_convertible<const bar,foo>::value should be false.
I see ... that would of course change the semantics. stefan

John Maddock ha escrito:
### mwcc Compiler: # In: ..\..\..\boost\type_traits\is_convertible.hpp # From: tricky_function_type_test.cpp # -------------------------------------- # 158: ); # Error: ^ # function call '_m_check({lval} void (), int)' does not match # 'boost::detail::is_convertible_basic_impl<void (&)(), boost::detail::int_convertible>::_m_check(boost::detail::any_conversion, ...)' (static) # 'boost::detail::is_convertible_basic_impl<void (&)(), boost::detail::int_convertible>::_m_check(boost::detail::int_convertible, int)' (static) # (point of instantiation: 'main()') # (instantiating: 'boost::is_enum<void ()>') # (instantiating:
I don't see any way around that unfortunately: the function call should be deduced to work OK: it does on EDG and gcc compilers, and ultimately all the possible implementations use either this method or the current one (or trivial variations). Is there any other way to work around the original problem?
I'm afraid there ain't. This popped up from original code like

John Maddock ha escrito:
### mwcc Compiler: # In: ..\..\..\boost\type_traits\is_convertible.hpp # From: tricky_function_type_test.cpp # -------------------------------------- # 158: ); # Error: ^ # function call '_m_check({lval} void (), int)' does not match # 'boost::detail::is_convertible_basic_impl<void (&)(), boost::detail::int_convertible>::_m_check(boost::detail::any_conversion, ...)' (static) # 'boost::detail::is_convertible_basic_impl<void (&)(), boost::detail::int_convertible>::_m_check(boost::detail::int_convertible, int)' (static) # (point of instantiation: 'main()') # (instantiating: 'boost::is_enum<void ()>') # (instantiating:
I don't see any way around that unfortunately: the function call should be deduced to work OK: it does on EDG and gcc compilers, and ultimately all the possible implementations use either this method or the current one (or trivial variations). Is there any other way to work around the original problem?
I'm afraid there ain't. This popped up from original code like typename disable_if<is_convertible<const ChainedPtr,Type>,Type&>::type operator()(const ChainedPtr& x)const; which disables operator() when ChainedPtr satisfies the is_convertible condition --basically I cannot do anything to prevent the problem as ChainedPtr is a user-provided type. Excuse my beating this problem to death, but maybe there's still some hope: If I'm getting it right, Stefan's tests show that CW works with the EDG pp-branch technique EXCEPT when From is a function type. Cannot we do then the following? 1. If is_function<From>::value, use the current tecnhique. 2. Else, use the EDG tecnhique. The attached file implements this idea. I cannot test it myself under CW, it'd be great is someone can give it a try. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

Excuse my beating this problem to death, but maybe there's still
Beat it up all you like :-)
some hope: If I'm getting it right, Stefan's tests show that CW works with the EDG pp-branch technique EXCEPT when From is a function type. Cannot we do then the following?
1. If is_function<From>::value, use the current tecnhique. 2. Else, use the EDG tecnhique.
The attached file implements this idea. I cannot test it myself under CW, it'd be great is someone can give it a try.
Stefan? John.

Joaquín Mª López Muñoz wrote:
The attached file implements this idea. I cannot test it myself under CW, it'd be great is someone can give it a try.
it seems that is_function doesn't work for this (function) type, either :-( Stefan ...found 318 targets... ...updating 5 targets... cw-C++-action ..\..\..\bin\boost\libs\type_traits\test\tricky_function_type_test.test\cw-9_4\debug\threading-multi\tricky_function_type_test.obj call "c:\Programme\Metrowerks\Codewarrior\Other Metrowerks Tools\Command Line Tools\cwenv.bat" -quiet set "ERRORLEVEL=" mwcc -c -lang c++ -maxerrors 5 -warnings on -maxwarnings 20 -nowraplines -g -O0 -inline off -cwd include -wchar_t on -warnings nounusedexpr,nounused -runtime dmd -RTTI on -iso_templates on "-I..\..\..\bin\boost\libs\type_traits\test" -I- "-IC:\views_cvs\boost" -o "..\..\..\bin\boost\libs\type_traits\test\tricky_function_type_test.test\cw-9_4\debug\threading-multi\tricky_function_type_test.obj" "C:\views_cvs\boost\libs\type_traits\test\tricky_function_type_test.cpp" ### mwcc Compiler: # In: ..\..\..\boost\type_traits\is_convertible.hpp # From: tricky_function_type_test.cpp # -------------------------------------- # 210: ); # Error: ^ # function call '_m_check({lval} void (), int)' does not match # 'boost::detail::is_convertible_basic_impl<void (&)(), boost::detail::int_convertible, false>::_m_check(boost::detail::any_conversion, ...)' (static) # 'boost::detail::is_convertible_basic_impl<void (&)(), boost::detail::int_convertible, false>::_m_check(boost::detail::int_convertible, int)' (static) # (point of instantiation: 'main()') # (instantiating: 'boost::is_enum<void ()>') # (instantiating: 'boost::detail::is_enum_impl<void ()>') # (instantiating: 'boost::detail::is_enum_helper<false>::type<void ()>') # (instantiating: 'boost::is_convertible<void (&)(), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_impl_dispatch<void (&)(), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_impl<void (&)(), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_basic_impl<void (&)(), boost::detail::int_convertible, false>') ### mwcc Compiler: # 210: ); # Error: ^ # function call '_m_check({lval} void (int), int)' does not match # 'boost::detail::is_convertible_basic_impl<void (&)(int), boost::detail::int_convertible, false>::_m_check(boost::detail::any_conversion, ...)' (static) # 'boost::detail::is_convertible_basic_impl<void (&)(int), boost::detail::int_convertible, false>::_m_check(boost::detail::int_convertible, int)' (static) # (point of instantiation: 'main()') # (instantiating: 'boost::is_enum<void (int)>') # (instantiating: 'boost::detail::is_enum_impl<void (int)>') # (instantiating: 'boost::detail::is_enum_helper<false>::type<void (int)>') # (instantiating: 'boost::is_convertible<void (&)(int), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_impl_dispatch<void (&)(int), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_impl<void (&)(int), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_basic_impl<void (&)(int), boost::detail::int_convertible, false>') ### mwcc Compiler: # 210: ); # Error: ^ # function call '_m_check({lval} void (int &, double), int)' does not match # 'boost::detail::is_convertible_basic_impl<void (&)(int &, double), boost::detail::int_convertible, false>::_m_check(boost::detail::any_conversion, ...)' (static) # 'boost::detail::is_convertible_basic_impl<void (&)(int &, double), boost::detail::int_convertible, false>::_m_check(boost::detail::int_convertible, int)' (static) # (point of instantiation: 'main()') # (instantiating: 'boost::is_enum<void (int &, double)>') # (instantiating: 'boost::detail::is_enum_impl<void (int &, double)>') # (instantiating: 'boost::detail::is_enum_helper<false>::type<void (int &, double)>') # (instantiating: 'boost::is_convertible<void (&)(int &, double), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_impl_dispatch<void (&)(int &, double), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_impl<void (&)(int &, double), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_basic_impl<void (&)(int &, double), boost::detail::int_convertible, false>') ### mwcc Compiler: # 210: ); # Error: ^ # function call '_m_check({lval} void (int &, bool, int, int), int)' does not match # 'boost::detail::is_convertible_basic_impl<void (&)(int &, bool, int, int), boost::detail::int_convertible, false>::_m_check(boost::detail::any_conversion, ...)' (static) # 'boost::detail::is_convertible_basic_impl<void (&)(int &, bool, int, int), boost::detail::int_convertible, false>::_m_check(boost::detail::int_convertible, int)' (static) # (point of instantiation: 'main()') # (instantiating: 'boost::is_enum<void (int &, bool, int, int)>') # (instantiating: 'boost::detail::is_enum_impl<void (int &, bool, int, int)>') # (instantiating: 'boost::detail::is_enum_helper<false>::type<void (int &, bool, int, int)>') # (instantiating: 'boost::is_convertible<void (&)(int &, bool, int, int), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_impl_dispatch<void (&)(int &, bool, int, int), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_impl<void (&)(int &, bool, int, int), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_basic_impl<void (&)(int &, bool, int, int), boost::detail::int_convertible, false>') ### mwcc Compiler: # 210: ); # Error: ^ # function call '_m_check({lval} void (int, bool, int *, int *, int, int, int, int, int), int)' does not match # 'boost::detail::is_convertible_basic_impl<void (&)(int, bool, int *, int *, int, int, int, int, int), boost::detail::int_convertible, false>::_m_check(boost::detail::any_conversion, ...)' (static) # 'boost::detail::is_convertible_basic_impl<void (&)(int, bool, int *, int *, int, int, int, int, int), boost::detail::int_convertible, false>::_m_check(boost::detail::int_convertible, int)' (static) # (point of instantiation: 'main()') # (instantiating: 'boost::is_enum<void (int, bool, int *, int *, int, int, int, int, int)>') # (instantiating: 'boost::detail::is_enum_impl<void (int, bool, int *, int *, int, int, int, int, int)>') # (instantiating: 'boost::detail::is_enum_helper<false>::type<void (int, bool, int *, int *, int, int, int, int, int)>') # (instantiating: 'boost::is_convertible<void (&)(int, bool, int *, int *, int, int, int, int, int), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_impl_dispatch<void (&)(int, bool, int *, int *, int, int, int, int, int), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_impl<void (&)(int, bool, int *, int *, int, int, int, int, int), boost::detail::int_convertible>') # (instantiating: 'boost::detail::is_convertible_basic_impl<void (&)(int, bool, int *, int *, int, int, int, int, int), boost::detail::int_convertible, false>') # Too many errors printed, aborting program ...failed cw-C++-action ..\..\..\bin\boost\libs\type_traits\test\tricky_function_type_test.test\cw-9_4\debug\threading-multi\tricky_function_type_test.obj... ...skipped <@boost!libs!type_traits!test\tricky_function_type_test.test\cw-9_4\debug\threading-multi>tricky_function_type_test.CMD for lack of <@boost!libs!type_traits!test\tricky_function_type_test.test\cw-9_4\debug\threading-multi>tricky_function_type_test.obj... ...skipped <@boost!libs!type_traits!test\tricky_function_type_test.test\cw-9_4\debug\threading-multi>tricky_function_type_test.exe for lack of <@boost!libs!type_traits!test\tricky_function_type_test.test\cw-9_4\debug\threading-multi>tricky_function_type_test.CMD... ...skipped <@boost!libs!type_traits!test\tricky_function_type_test.test\cw-9_4\debug\threading-multi>tricky_function_type_test.run for lack of <@boost!libs!type_traits!test\tricky_function_type_test.test\cw-9_4\debug\threading-multi>tricky_function_type_test.exe... ...failed updating 1 target... ...skipped 4 targets...

Stefan Slapeta ha escrito:
Joaquín Mª López Muñoz wrote:
The attached file implements this idea. I cannot test it myself under CW, it'd be great is someone can give it a try.
it seems that is_function doesn't work for this (function) type, either :-(
What's happening now is that the function type detection mechanisn does not catch function *references*, and it should. Could you give the attached file a try? Hopefully results will be more promising now.
Stefan
Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

Joaquín Mª López Muñoz wrote:
What's happening now is that the function type detection mechanisn does not catch function *references*, and it should.
yes. and it's very funny where the origin of this function reference lies: is_enum.hpp
Could you give the attached file a try? Hopefully results will be more promising now.
Applied! :-) Stefan

Stefan Slapeta ha escrito:
Joaquín Mª López Muñoz wrote:
What's happening now is that the function type detection mechanisn does not catch function *references*, and it should.
yes. and it's very funny where the origin of this function reference lies: is_enum.hpp
Could you give the attached file a try? Hopefully results will be more promising now.
Applied! :-)
Do you mean you have commited to the CVS? Does it pass the tests? Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

Joaquín Mª López Muñoz ha escrito:
Stefan Slapeta ha escrito:
Joaquín Mª López Muñoz wrote:
What's happening now is that the function type detection mechanisn does not catch function *references*, and it should.
yes. and it's very funny where the origin of this function reference lies: is_enum.hpp
Could you give the attached file a try? Hopefully results will be more promising now.
Applied! :-)
Do you mean you have commited to the CVS? Does it pass the tests?
Including mine which involves std::auto_ptr? Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

Joaquín Mª López Muñoz wrote:
Do you mean you have commited to the CVS? Does it pass the tests?
Including mine which involves std::auto_ptr?
yes and yes :-) BTW, maybe john could add this to the type_traits tests?? At the moment I'm wondering, what compilers might pass to an ellipsis if an argument is not copy constructible. I don't understand that it works - at least for any other compiler than cw. stefan

Joaquín Mª López Muñoz wrote:
Do you mean you have commited to the CVS? Does it pass the tests?
Including mine which involves std::auto_ptr?
yes and yes :-) BTW, maybe john could add this to the type_traits tests?? At the moment I'm wondering, what compilers might pass to an ellipsis if an argument is not copy constructible. I don't understand that it works - at least for any other compiler than cw. stefan

On Feb 10, 2006, at 1:33 AM, Joaquín Mª López Muñoz wrote:
The attached file implements this idea. I cannot test it myself under CW, it'd be great is someone can give it a try.
So this test code compiles cleanly with CW 10.0 and the patched is_convertible.hpp. -- Noel #include <memory> #include <is_convertible.hpp> class foo{}; int main(int ac, char *av[]) { typedef boost::is_convertible<const std::auto_ptr<const foo *>, const foo> type; bool b=type::value; return 0; }

Stefan Slapeta ha escrito:
John Maddock wrote:
Could you please run the complete type traits tests, and if there are no new regressions then go ahead and commit?
:-(
stefan
[...]
### mwcc Compiler: # In: ..\..\..\boost\type_traits\is_convertible.hpp # From: tricky_function_type_test.cpp # -------------------------------------- # 158: ); # Error: ^ # function call '_m_check({lval} void (), int)' does not match # 'boost::detail::is_convertible_basic_impl<void (&)(), boost::detail::int_convertible>::_m_check(boost::detail::any_conversion, ...)' (static) # 'boost::detail::is_convertible_basic_impl<void (&)(), boost::detail::int_convertible>::_m_check(boost::detail::int_convertible, int)' (static)
[...] I'm far from being an expert in this area, but, what happens if you change the second ctor of any_conversion (which is only to kick in for function references) from template <typename T> any_conversion(T&); to template <typename T> any_conversion(T); ?? Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

I'm far from being an expert in this area, but, what happens if you change the second ctor of any_conversion (which is only to kick in for function references) from
template <typename T> any_conversion(T&);
to
template <typename T> any_conversion(T);
I don't believe that would help: in fact it would make the two constructors ambiguous, and in any case you can't pass a function type through a by-value constructor. John.
participants (6)
-
JOAQUIN LOPEZ MU?Z
-
Joaquin M Lopez Munoz
-
Joaquín Mª López Muñoz
-
John Maddock
-
Noel Belcourt
-
Stefan Slapeta