Re: Bison C++ mid-rule value lost with variants

2017-06-29 Thread Hans Åberg
> On 29 Jun 2017, at 15:55, Piotr Marcińczyk wrote: > > I supposedly found a bug in lalr1.cc skeleton with variant semantic type. You might check if std::variant, of C++17, can be used instead. Cf. http://en.cppreference.com/w/cpp/utility/variant > When using mid-rule

Re: Bison C++ mid-rule value lost with variants

2017-06-29 Thread Piotr Marcińczyk
Thanks for the workaround. Actually, I used marker tokens with actions getting value from stack before the rule, e.g.: %type AnswerToLifeMarker expr: expr AnswerToLifeMarker + NUM { std::cout << $2 << std::endl; }; AnswerToLifeMarker: { usePreviousExpr($0); $$ = 42; }; ​That's because I need

Re: Bison C++ mid-rule value lost with variants

2017-06-29 Thread Kaz Kylheku
On 29.06.2017 06:55, Piotr Marcińczyk wrote: I supposedly found a bug in lalr1.cc skeleton with variant semantic type. When using mid-rule action { $$ = value; } to return a value that will be used in further semantic actions, it appears that the value on stack becomes zero. Tested with Bison