[mpl][patch] mpl::begin<an_integral_c> fails to compile

WHAT: ===== An instantiation of "begin<T>::type" fails to compile if T is an MPL Integral Constant. 'begin' is supposed to return 'void_' for all types that do not model the MPL Sequence concept. The bug also causes 'is_sequence' to fail. FILES: ====== - begin_end_impl.hpp.patch changes needed to make things work like documented - is_sequence.cpp.patch inclusion of the problematic case in the test suite diffed against: CVS HEAD TESTED WITH: ============ - MSVC 8.0 - MSVC 7.1 - GCC 3.4.2 Index: boost/mpl/aux_/begin_end_impl.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/mpl/aux_/begin_end_impl.hpp,v retrieving revision 1.8 diff -u -r1.8 begin_end_impl.hpp --- boost/mpl/aux_/begin_end_impl.hpp 2 Sep 2004 15:40:43 -0000 1.8 +++ boost/mpl/aux_/begin_end_impl.hpp 15 May 2006 23:22:17 -0000 @@ -17,12 +17,30 @@ #include <boost/mpl/begin_end_fwd.hpp> #include <boost/mpl/sequence_tag_fwd.hpp> #include <boost/mpl/void.hpp> +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/aux_/has_begin.hpp> #include <boost/mpl/aux_/na.hpp> #include <boost/mpl/aux_/traits_lambda_spec.hpp> #include <boost/mpl/aux_/config/eti.hpp> namespace boost { namespace mpl { + +namespace aux { + +template< typename Sequence > +struct begin_type +{ + typedef typename Sequence::begin type; +}; +template< typename Sequence > +struct end_type +{ + typedef typename Sequence::end type; +}; + +} + // default implementation; conrete sequences might override it by // specializing either the 'begin_impl/end_impl' or the primary // 'begin/end' templates @@ -32,7 +50,8 @@ { template< typename Sequence > struct apply { - typedef typename Sequence::begin type; + typedef typename eval_if<aux::has_begin<Sequence, true_>, + aux::begin_type<Sequence>, void_>::type type; }; }; @@ -41,7 +60,8 @@ { template< typename Sequence > struct apply { - typedef typename Sequence::end type; + typedef typename eval_if<aux::has_begin<Sequence, true_>, + aux::end_type<Sequence>, void_>::type type; }; }; Index: libs/mpl/test/is_sequence.cpp =================================================================== RCS file: /cvsroot/boost/boost/libs/mpl/test/is_sequence.cpp,v retrieving revision 1.5 diff -u -r1.5 is_sequence.cpp --- libs/mpl/test/is_sequence.cpp 2 Sep 2004 15:41:35 -0000 1.5 +++ libs/mpl/test/is_sequence.cpp 15 May 2006 22:55:40 -0000 @@ -12,6 +12,7 @@ // $Revision: 1.5 $ #include <boost/mpl/is_sequence.hpp> +#include <boost/mpl/int.hpp> #include <boost/mpl/list.hpp> #include <boost/mpl/vector.hpp> #include <boost/mpl/range_c.hpp> @@ -25,6 +26,7 @@ MPL_TEST_CASE() { MPL_ASSERT_NOT(( is_sequence< std_vector<int> > )); + MPL_ASSERT_NOT(( is_sequence< int_<0> > )); MPL_ASSERT_NOT(( is_sequence< int > )); MPL_ASSERT_NOT(( is_sequence< int& > )); MPL_ASSERT_NOT(( is_sequence< UDT > ));

Tobias Schwinger <tschwinger@neoscientists.org> writes:
WHAT: =====
An instantiation of "begin<T>::type" fails to compile if T is an MPL Integral Constant. 'begin' is supposed to return 'void_' for all types that do not model the MPL Sequence concept. The bug also causes is_sequence' to fail.
FILES: ======
- begin_end_impl.hpp.patch
changes needed to make things work like documented
- is_sequence.cpp.patch
inclusion of the problematic case in the test suite
diffed against: CVS HEAD
Looks good to me. Please apply to HEAD and, (unless Aleksey contradicts me) after you see the test results, also to the RC branch. -- Dave Abrahams Boost Consulting www.boost-consulting.com

[... patch sumbission ...] David Abrahams wrote:
Looks good to me. Please apply to HEAD and, (unless Aleksey contradicts me) after you see the test results, also to the RC branch.
Warning: Unable to update explicit markup files/XSLT source from CVS. Warning: CVS snapshot is 180 hours old. Is the head being tested HEAD at all, ITM? Thanks, Tobias

Tobias Schwinger wrote:
[... patch sumbission ...]
David Abrahams wrote:
Looks good to me. Please apply to HEAD and, (unless Aleksey contradicts me) after you see the test results, also to the RC branch.
Warning: Unable to update explicit markup files/XSLT source from CVS. Warning: CVS snapshot is 180 hours old.
Is the head being tested HEAD at all, ITM?
I can only speak for my tests, but I currently have suspended all testing (HEAD and RC) because of the SF CVS issues. Only after the stale lock is removed (for which at least three support requests are open) it makes sense to resume the testing. Markus

Markus Schöpflin wrote: [...]
I can only speak for my tests, but I currently have suspended all testing (HEAD and RC) because of the SF CVS issues. Only after the stale lock is removed (for which at least three support requests are open) it makes sense to resume the testing.
Note that there's at least one other stale lock, in /cvsroot/boost/boost/tools/build/examples/sublib_use/sublib, which I reported here: http://sourceforge.net/tracker/index.php?func=detail&aid=1490727&group_id=1&atid=200001 Cheers, Nicola Musatti
participants (4)
-
David Abrahams
-
Markus Schöpflin
-
Nicola Musatti
-
Tobias Schwinger