You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
boost::python::make_setter(&X::y) no longer compiles #39
This trivial example, similar to the examples in the Boost.Python documentation, compiled with 1.58 but doesn't with 1.59 (using various versions of GCC and Clang):
#include <boost/python.hpp>
struct X { int y; };
int main()
{
boost::python::make_setter(&X::y);
}
The relevant error is:
/usr/local/boost-1.59.0/include/boost/python/data_members.hpp:303:15: note: candidate: boost::python::api::object boost::python::make_setter(D&) [with D = int X::*] <near match>
inline object make_setter(D& x)
^
/usr/local/boost-1.59.0/include/boost/python/data_members.hpp:303:15: note: conversion of argument 1 would be ill-formed:
prog.cc:7:37: error: invalid initialization of non-const reference of type 'int X::*&' from an rvalue of type 'int X::*'
This was caused by 42e7d7b which broke the preprocessor condition for make_setter by inverting the sense of the test. There was a later change in 590b788 but it didn't restore the old behaviour.
Thank you for your reply. I already tried that to no avail, which I find quite odd.
I tried adding the "missing" overload in different places in the code, but still see errors like:
../src/py_amount.cc:131:26: error: no matching function for call to 'make_setter'
make_setter(&amount_t::is_initialized))
^~~~~~~~~~~
/opt/homebrew/include/boost/python/data_members.hpp:303:15: note: candidate function [with D = bool *] not viable: no known conversion from 'bool *' to 'bool *&' for 1st argument
inline object make_setter(D& x)
^
/opt/homebrew/include/boost/python/data_members.hpp:291:15: note: candidate function template not viable: requires 2 arguments, but 1 was provided
inline object make_setter(D& x, Policies const& policies)
@stefanseefeld The #40 fix works just fine. Yet I would like to make the project aware that boost python 1.59 has an issue and address that with a workaround within the project.
Yes, I understand. But even if you ask for help on your own code, it's hard to do so without seeing the actual code. (And often enough putting together a test case might in itself reveal the problem, so it's a good strategy anyhow. :-))
Be aware that Fedora rawhide (which will become Fedora 24) has a patched version of Boost 1.59.0 which includes the fix, so putting a workaround in the project might conflict with that patched version of Boost.
I'm afraid I may have had an unclean environment, in which I tested. With a fresh workspace and merely the proposed changes by @jwakely it compiles just fine.
@stefanseefeld Thanks for the advice. I'll remember it for next time.
(This is entirely off-topic, but anyhow: Given that "#if BOOST_VERSION == 105900" appears to be the condition under which you'll need this patch, there is really nothing to configure for. Just put the above patch from @jwakely into your source code wherever needed and move on.)
Activity
jwakely commentedon Sep 2, 2015
This was caused by 42e7d7b which broke the preprocessor condition for
make_setterby inverting the sense of the test. There was a later change in 590b788 but it didn't restore the old behaviour.Python: Fix condition for make_setter overload.
afh commentedon Sep 15, 2015
What intermediate solution can projects (e.g. ledger) use to fix this until the next release of boost python?
jwakely commentedon Sep 15, 2015
You could define the "missing" overload in your own code:
afh commentedon Sep 15, 2015
Thank you for your reply. I already tried that to no avail, which I find quite odd.
I tried adding the "missing" overload in different places in the code, but still see errors like:
jwakely commentedon Sep 15, 2015
Looks like you didn't declare the overload everywhere it's needed, since it's not listed as a candidate function.
stefanseefeld commentedon Sep 15, 2015
(As usual, it might help to put together a minimal test case and share that. Otherwise it's hard to help just by second-guessing.)
afh commentedon Sep 15, 2015
@stefanseefeld The #40 fix works just fine. Yet I would like to make the project aware that boost python 1.59 has an issue and address that with a workaround within the project.
stefanseefeld commentedon Sep 15, 2015
Yes, I understand. But even if you ask for help on your own code, it's hard to do so without seeing the actual code. (And often enough putting together a test case might in itself reveal the problem, so it's a good strategy anyhow. :-))
jwakely commentedon Sep 15, 2015
Be aware that Fedora rawhide (which will become Fedora 24) has a patched version of Boost 1.59.0 which includes the fix, so putting a workaround in the project might conflict with that patched version of Boost.
afh commentedon Sep 15, 2015
I'm afraid I may have had an unclean environment, in which I tested. With a fresh workspace and merely the proposed changes by @jwakely it compiles just fine.
@stefanseefeld Thanks for the advice. I'll remember it for next time.
afh commentedon Sep 15, 2015
@jwakely Thanks for the heads up. How would such an issue be addressed best?
jwakely commentedon Sep 15, 2015
Yes, I would add an autoconf / cmake test and only add the missing overload if needed.
stefanseefeld commentedon Sep 15, 2015
(This is entirely off-topic, but anyhow: Given that "#if BOOST_VERSION == 105900" appears to be the condition under which you'll need this patch, there is really nothing to configure for. Just put the above patch from @jwakely into your source code wherever needed and move on.)
16 remaining items
libraries/CEGUI: Updated for version 0.8.4.
libraries/CEGUI0.7: Fixed build with boost-1.59.
libraries/CEGUI: Updated for version 0.8.4.
libraries/CEGUI0.7: Fixed build with boost-1.59.
Merge pull request boostorg#39 from termoshtt/cmake_python3
Merge pull request boostorg#39 from termoshtt/cmake_python3