Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7769: BOOST_MPL_LIMIT_METAFUNCTION_ARITY > 8 causes compilation error on gcc
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-02-08 14:33:17
#7769: BOOST_MPL_LIMIT_METAFUNCTION_ARITY > 8 causes compilation error on gcc
------------------------------------+---------------------------------
Reporter: Adam Lach <salvage@â¦> | Owner: agurtovoy
Type: Bugs | Status: new
Milestone: To Be Determined | Component: mpl
Version: Boost 1.52.0 | Severity: Problem
Resolution: | Keywords: arity, metafunction
------------------------------------+---------------------------------
Comment (by brunocodutra@â¦):
I found the issue to be the definition of BOOST_MPL_PP_RANGE in
aux_/preprocessor/range.hpp:
{{{
#define BOOST_MPL_PP_RANGE(first, length) \
BOOST_PP_SEQ_SUBSEQ((0)(1)(2)(3)(4)(5)(6)(7)(8)(9), first, length) \
/**/
}}}
It is hardcoded to generate a range of at most 8 elements, hence the
observed issue when trying to increase BOOST_MPL_LIMIT_METAFUNCTION_ARITY
past 8.
A fairly straightforward workaround is to redefine BOOST_MPL_PP_RANGE so
as to generate a sequence of adequate length using boost preprocessor:
{{{
#include <boost/mpl/aux_/preprocessor/range.hpp>
#include <boost/preprocessor/enum.hpp>
#include <boost/preprocessor/tuple.hpp>
#include <boost/preprocessor/arithmetic.hpp>
#include <boost/preprocessor/punctuation.hpp>
#define COUNT(z, n, _) n
#undef BOOST_MPL_PP_RANGE
#define BOOST_MPL_PP_RANGE(first, length) \
BOOST_PP_SEQ_SUBSEQ( \
BOOST_PP_TUPLE_TO_SEQ( \
BOOST_PP_ADD(first, length), \
BOOST_PP_LPAREN() \
BOOST_PP_ENUM(BOOST_PP_ADD(first, length), COUNT, _) \
BOOST_PP_RPAREN() \
), \
first, length \
) \
/**/
}}}
This compiled just fine on my setup.
{{{
3.18.5-1-ARCH #1 SMP PREEMPT Fri Jan 30 07:31:50 CET 2015
clang version 3.5.1 (tags/RELEASE_351/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
}}}
I'd be most pleased to set up a patch for this in case it is required.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/7769#comment:1> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC