[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bison C++ mid-rule value lost with variants
From: |
Hans Åberg |
Subject: |
Re: Bison C++ mid-rule value lost with variants |
Date: |
Thu, 29 Jun 2017 21:35:29 +0200 |
> On 29 Jun 2017, at 15:55, Piotr Marcińczyk <address@hidden> 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 action { $<type>$ = 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 version 3.0.4.
This happens also if moved out to a separate rule, perhaps overwritten by the
token semantic value. So it does not look safe for use.