Hans Åberg wrote:

> But you can't safely or in general have Bison writing $$ =
> std::move(a) directly as one might do something else to a
> afterwards.

It would be safe if Bison checked that it's used only once in the
action.

> So a way to make it safe is to jump out of the action statement.

Not necessarily: You could use it twice within one expression
(unsafe even with jump) or just not use it twice (safe even without
jump).

> > What I want (or actually have, since I imeplented it :) is a way to
> > make Bison apply std::move automatically.
> 
> But that just applies it always, which might be safe for your move only type,

In fact it's safe for copy-only types, and possibly unsafe precisely
for movable types (move-only or move-and-copyable).

> but is not safe in general, right?

Right, that't why I made it opt-in by setting api.rhs.access.

Regards,
Frank

Reply via email to