Closed apolukhin closed 5 years ago
Proto creates references to parsers, even in constructors, that's why you have references to temporaries. You can make copy of the parser with qi::copy
(that's what BOOST_SPIRIT_AUTO
does). It should be possible to fix Proto to make copies of prvalues.
So the best thing to do is to move that issue to the Boost.Proto issues?
You can try. While it is by design (Proto has by_value_generator
, but Spirit uses the default one) at least a static assert can be added to prevent that kind of bugs.
This is a proto issue. As mentioned, Proto creates references. There is a way to do a deep copy if needed: https://github.com/boostorg/spirit/blob/develop/include/boost/spirit/home/qi/copy.hpp
I will close this issue now.
Oh and BTW, X3 always does a deep copy of expression trees.
The following example causes ASAN failures:
ASAN reports stack use after scope: