[type_traits][cw] is_convertible compile failure

classic Classic list List threaded Threaded
26 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[type_traits][cw] is_convertible compile failure

Joaquin M LópezMuñoz
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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

is_convertible.cpp (334 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [type_traits][cw] is_convertible compile failure

John Maddock
> 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.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [type_traits][cw] is_convertible compile failure

Stefan Slapeta
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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [type_traits][cw] is_convertible compile failure

Stefan Slapeta
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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [type_traits][cw] is_convertible compile failure

Joaquin M LópezMuñoz


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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [type_traits][cw] is_convertible compile failure

John Maddock
In reply to this post by Stefan Slapeta
> BTW, it doesn't break is_convertible_test, at least :-)

Could you please run the complete type traits tests, and if there are no new
regressions then go ahead and commit?

Thanks, John.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [type_traits][cw] is_convertible compile failure

Stefan Slapeta
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...

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [type_traits][cw] is_convertible compile failure

John Maddock
>> ### 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.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [type_traits][cw] is_convertible compile failure

Joaquin M LópezMuñoz
In reply to this post by Stefan Slapeta
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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [type_traits][cw] is_convertible compile failure

Stefan Slapeta
In reply to this post by John Maddock
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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [type_traits][cw]is_convertible compile failure

Joaquin M LópezMuñoz
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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [type_traits][cw] is_convertible compile failure

John Maddock
In reply to this post by Joaquin M LópezMuñoz
> 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.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [type_traits][cw] is_convertible compile failure

John Maddock
In reply to this post by Stefan Slapeta
> 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.
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [type_traits][cw] is_convertible compile failure

Stefan Slapeta
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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [type_traits][cw]is_convertible compile failure

Stefan Slapeta
In reply to this post by Joaquin M LópezMuñoz
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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [type_traits][cw] is_convertible compile failure

Joaquin M LópezMuñoz
In reply to this post by John Maddock


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


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [type_traits][cw] is_convertible compile failure

Joaquin M LópezMuñoz
In reply to this post by John Maddock


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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

is_convertible.hpp (18K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [type_traits][cw] is_convertible compile failure

John Maddock
>> 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.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [type_traits][cw] is_convertible compile failure

Stefan Slapeta
In reply to this post by Joaquin M LópezMuñoz
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...

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [type_traits][cw] is_convertible compile failure

Joaquin M LópezMuñoz


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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

is_convertible.hpp (17K) Download Attachment
12