Opened 10 years ago

Closed 6 years ago

#7165 closed Bugs (fixed)

cannot change BOOST_PHOENIX_LIMIT

Reported by: m.champlon@… Owned by: Thomas Heller
Milestone: To Be Determined Component: phoenix
Version: Boost 1.50.0 Severity: Problem
Keywords: Cc:

Description

Hi !

The following code :

#define BOOST_PHOENIX_LIMIT 20 #include <boost/phoenix.hpp>

fails to compile with boost 1.50 and msvc 2010 with an error trace starting with :

1>C:\dev\include\boost/phoenix/core/preprocessed/actor_30.hpp(10): error C2977: 'boost::proto::and_' : too many template arguments 1> C:\dev\include\boost/proto/matches.hpp(784) : see declaration of 'boost::proto::and_'

The following compiles :

#define BOOST_PHOENIX_LIMIT 20 #define BOOST_PROTO_MAX_LOGICAL_ARITY 20 #include <boost/phoenix.hpp>

In http://boost.2283326.n4.nabble.com/phoenix-not-playing-nice-with-other-libs-td3489758.html Eric Niebler seems to suggest that proto::and_ should be split and nested to avoid having to change BOOST_PROTO_MAX_LOGICAL_ARITY, wouldn't that solve the issue ?

Thanks, MAT.

Attachments (1)

boost_phoenix_7165.patch (4.6 KB ) - added by Mathieu Champlon <m.champlon@…> 9 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by m.champlon@…, 10 years ago

It looks like a fix for this issue would be in limits.hpp to change :

#if defined(BOOST_PHOENIX_LIMIT)
#define BOOST_PROTO_MAX_ARITY BOOST_PHOENIX_LIMIT

into :

#if defined(BOOST_PHOENIX_LIMIT)
#define BOOST_PROTO_MAX_ARITY BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT)

comment:2 by m.champlon@…, 10 years ago

A bit of follow-up,

The following code fails :

#define BOOST_PHOENIX_LIMIT 20
#define BOOST_PROTO_MAX_LOGICAL_ARITY BOOST_PHOENIX_LIMIT
#include <boost/phoenix/core/argument.hpp>

void f()
{
    boost::phoenix::arg_names::arg11;
}

with :

error C2039: 'arg11' : is not a member of 'boost::phoenix::arg_names'

Adding this to the top :

#define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES

yields :

...phoenix/core/environment.hpp(412): warning C4005: 'BOOST_PHOENIX_M0' : macro redefinition
...phoenix/support/detail/iterate_define.hpp(108) : see previous definition of 'BOOST_PHOENIX_M0'

I hope this helps, tell me if there is anything I can do to help fix all this.

Thanks !
MAT.

by Mathieu Champlon <m.champlon@…>, 9 years ago

Attachment: boost_phoenix_7165.patch added

comment:3 by Mathieu Champlon <m.champlon@…>, 9 years ago

I finally managed to write a test case and a fix for this, see boost_phoenix_7165.patch

The patch initially contained the regenerated preprocessed actor.hpp files but the server refused to upload it because it's over the size limit (it's 566 KB !). I still have it and can email it directly to you if you want.

The idea of the fix is to replace

boost::proto::and_<
  something,
  something,
  something,
  ...
>

with

boost::proto::and_< something,
boost::proto::and_< something,
boost::proto::and_< something,
  ...
> > >

Cheers, MAT.

comment:4 by John Fletcher <J.P.Fletcher@…>, 9 years ago

This patch and test have now been released on develop for testing.

comment:5 by Kohei Takahashi, 6 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.