> On 19 Aug 2016, at 05:50, Min Wang <mingew...@gmail.com> wrote:
> on another thread at: > http://lists.gnu.org/archive/html/bug-bison/2016-08/msg00006.html I am on that list, too. > it seems I could use std::unique_ptr as the semantic value , but need one > hack > > - return *new (yyas_<T> ()) T (t); > + return *new (yyas_<T> ()) T (std::move((T&)t)); The issue is that in the original C parser, the implicit $$ = $1 that occurs when not writing an explicit action is always executed first before any other eventual action. In C this is fine, and not so so expensive as there are no copy constructors. This implementation was carried over at least in the original C++ parser. When you then use the std::unique_ptr in $1 it will first implicitly move over to $$, and if trying to access $1 explicitly in an action, the pointer is dead. So the hack depends on what the C++ implementation currently is, which may change. _______________________________________________ help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison