Range/workaround test: SFINAE defect on EDG?

First of all, the most important question: Why do we test workarounds for partial spezialization on compiler which don't need these workarounds? I've isolated the problem with the failing range/workaround testcase on Intel 8. IMO it's a compiler defect because the function template in is_array should be disabled by SFINAE. This code fails to compile with the current comeau release, too. template <class T> struct wrap {}; // this one should disabled because it's not allowed to return an array: template< typename T > T(* is_array_tester1(wrap<T>) )(wrap<T>); char is_array_tester1(...); void f() { sizeof(is_array_tester1(wrap<int[42]>()); } Shall a submit a DR? Stefan

"Stefan Slapeta" <stefan_nospam_@slapeta.com> wrote in message news:cebvag$5i2$1@sea.gmane.org... | | First of all, the most important question: Why do we test workarounds | for partial spezialization on compiler which don't need these workarounds? Do you know how to make the test run for only the relevant compilers? | I've isolated the problem with the failing range/workaround testcase on | Intel 8. IMO it's a compiler defect because the function template in | is_array should be disabled by SFINAE. This code fails to compile with | the current comeau release, too. | | | template <class T> struct wrap {}; | | // this one should disabled because it's not allowed to return an array: | template< typename T > T(* is_array_tester1(wrap<T>) )(wrap<T>); What does the line above mean in plain English :-) And why is is_array not defined as template< class T, int sz > true_type is_array( const T (&array)[sz] ); template< class T, int sz > true_type is_array( T (&array)[sz] ); no_type is_array( ... ); ? br Thorsten

Do you know how to make the test run for only the relevant compilers?
I've not found it yet, either; maybe Aleksey can help. _However_: When you have a look at numeric/ublas, you will see that test7 is only executed on some few compilers (no idea, why). Of course, this could also be a defect :)
It's only the half solution but it was enough to show the SFINAE problem. The complete code looks like this: template< typename T > T(* is_array_tester1(wrap<T>) )(wrap<T>); char BOOST_TT_DECL is_array_tester1(...); template< typename T> no_type is_array_tester2(T(*)(wrap<T>)); yes_type BOOST_TT_DECL is_array_tester2(...); template< typename T > struct is_array_impl { BOOST_STATIC_CONSTANT(bool, value = sizeof(::boost::detail::is_array_tester2( ::boost::detail::is_array_tester1( ::boost::type_traits::wrap<T>() ) )) == 1 ); }; Here, if a function returning T can be instantiated (is_array_tester1), T cannot be an array. This is tested by is_array_tester2.
This was my first question, too, but the answer probably can only give any of the authors. It could be: "does this work with open arrays?" Stefan

Stefan Slapeta writes:
See http://article.gmane.org/gmane.comp.lib.boost.devel/106440. -- Aleksey Gurtovoy MetaCommunications Engineering
participants (5)
-
Aleksey Gurtovoy
-
John Maddock
-
Stefan Slapeta
-
Stefan Slapeta
-
Thorsten Ottosen