On 05/12/2012 3:43 PM, John Horigan wrote:
Can I solve the problem by changing all of my auto_ptr<> declarations from
this:
exp_ptr mod($2);
to this:
exp_ptr mod($2); $2 = 0;
to explicitly move ownership from the semantic value stack to my
auto_ptr<>? Would this actually do what I think it does and can I
still use @2 after erasing $2?
I am surprised you did not run immediately into double delete problems
without exceptions. Do you have leaks if not using auto_ptr?
I am not knowledgeable of the inner workings of that skeleton but I
think that, since the parser is the one that created the token, then the
parser is in control of its lifetime and it guarantees the availability.
The parser should own it, in particular because it has to be able to
backtrack.
Regards,
a.
_______________________________________________
help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison