mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
lalr1.cc: fix stack symbol move
In some casing, once we moved a stack symbol, we forget to mark the source stack symbol as emptied. As a consequence, it may be destroyed a second time. This happens when the stack has to be resized. * data/lalr1.cc (stack_symbol_type::stack_symbol_type): Record that the source was emptied. (stack_symbol_type::operator=): Likewise. * tests/c++.at (C++ Variant-based Symbols Unit Tests): Force the stack to be resized. Check its content.
This commit is contained in:
@@ -602,6 +602,10 @@ m4_if(b4_prefix, [yy], [],
|
||||
{]b4_variant_if([
|
||||
b4_symbol_variant([that.type_get ()],
|
||||
[value], [YY_MOVE_OR_COPY], [YY_MOVE (that.value)])])[
|
||||
#if defined __cplusplus && 201103L <= __cplusplus
|
||||
// that is emptied.
|
||||
that.state = empty_state;
|
||||
#endif
|
||||
}
|
||||
|
||||
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) that)
|
||||
@@ -622,6 +626,8 @@ m4_if(b4_prefix, [yy], [],
|
||||
[value], [move], [YY_MOVE (that.value)])],
|
||||
[[value = YY_MOVE (that.value);]])[]b4_locations_if([
|
||||
location = YY_MOVE (that.location);])[
|
||||
// that is emptied.
|
||||
that.state = empty_state;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user