mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 14:23:04 +00:00
variants: prohibit simple copies
The "variant" structure provides a means to store, in a typeless way, C++ objects. Manipulating it without provide the type of the stored content is doomed to failure. So provide a means to copy in a type safe way, and prohibit typeless assignments. * data/c++.m4 (symbol_type::move): New. * data/lalr1.cc: Use it. * data/variant.hh (b4_variant_define): Provide variant::copy. Let variant::operator= abort. We cannot undefine it, yet, as it is still uses by the implicit assigment in symbols, which must also be disabled.
This commit is contained in:
@@ -721,10 +721,11 @@ b4_dollar_popdef])[]dnl
|
||||
try
|
||||
{
|
||||
]b4_token_ctor_if(
|
||||
[ yyla = b4_function_call([yylex], [symbol_type],
|
||||
m4_ifdef([b4_lex_param], b4_lex_param));],
|
||||
[ yyla.type = yytranslate_ (b4_function_call([yylex], [int],
|
||||
[b4_api_PREFIX[STYPE*], [&yyla.value]][]dnl
|
||||
[ symbol_type yylookahead = b4_function_call([yylex], [symbol_type],
|
||||
m4_ifdef([b4_lex_param], b4_lex_param));
|
||||
yyla.move(yylookahead);],
|
||||
[ yyla.type = yytranslate_ (b4_function_call([yylex], [int],
|
||||
[b4_api_PREFIX[STYPE*], [&yyla.value]][]dnl
|
||||
b4_locations_if([, [[location*], [&yyla.location]]])dnl
|
||||
m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user