Comments (3)
This is https://svn.boost.org/trac10/ticket/8298.
@fletchjp said there:
The bug here is that this ever worked. The local variables _a do not provide a true variable. This means that _a = 17 followed by _a = 18 amounts to 17 = 18 i.e. assigning to a constant.
from phoenix.
I investigated this and found multiple bugs.
-
The
let
documentation states that_a
should hasint
type, but for C++11 it isint const&
because of tr1/decltype result_of differences https://wandbox.org/permlink/27AcBJnXskKPl9uU. If you defineBOOST_RESULT_OF_USE_TR1
the example will compile run https://wandbox.org/permlink/Daf4VxdLyETDRs8p. -
Internally Phoenix places locals into a vector and than operates on it through const reference, so actually it cannot modify it and passes
_a
asint const&
, but mutual operators were working becauseint const&
was casted toint&
here -
The other bug is that
let(_a = 0)[_a]()
returns a reference to temporary (withBOOST_RESULT_OF_USE_TR1
even non-const!).
It looks like a disaster, users can use those references to temporaries and do not know this. I have some thoughts about this:
- I think that
let(_a = 0)[--_a]()
should work. - The return type of it (and
let(_a = 0)[_a]()
) must be a value. - Making things above will require to distinguish between temporaries and references. With C++11 it is not a problem (rvalues will be stored as value types), but for C++98
let
will start copying const references values (it can be avoided by users withref
; non-const values will work fine).
from phoenix.
from phoenix.
Related Issues (20)
- Namespace for Phoenix in the documentation HOT 1
- Request: Adapted std::get and an unpack function HOT 2
- deprecated-copy warnings with GCC 11
- Please merge develop to master HOT 2
- boost 1.8.1 beta1+gcc-12: multiple definition of `boost::phoenix::placeholders::uarg1' HOT 27
- clang-15 warning: definition of implicit copy constructor for 'actor<boost::log::expressions::aux::unary_function_terminal<boost::log::expressions::has_attribute<void>>>' is deprecated because it has a user-declared copy assignment operator HOT 4
- Boost 1.81.0: error: 'arg1' is not a member of 'boost::phoenix::placeholders'; did you mean 'uarg1'? HOT 5
- error: definition of implicit copy constructor for 'member_close_operation<boost::iostreams::detail::linked_streambuf<char>>' is deprecated because it has a user-declared copy assignment operator [-Werror,-Wdeprecated-copy]
- Merge to master
- The whole folder of test is unused: bll_compatibility HOT 1
- ASan detects use after scope in `member` test
- trac ticket 9363 can be closed HOT 2
- compile fails when using phoenix construct with qi::_12 placeholder. HOT 1
- Build error on windows (VS 2017) on x86 but not x64 (using boost 1.69.0) HOT 5
- do_ leads to incosistency HOT 1
- List of non BOOST-prefixed macros HOT 5
- VC7.1 errors when including `<boost/phoenix.hpp>` HOT 1
- asan detects stack-buffer-overflow when using try/catch HOT 3
- Merge to master for 1.73 HOT 2
- clang-10 warning: definition of implicit copy constructor is deprecated HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phoenix.