c++: fix the use of destructors when variants are enabled

When using variants, destructors generate invalid code.
<http://lists.gnu.org/archive/html/bug-bison/2014-09/msg00005.html>
Reported by Michael Catanzaro.

* data/c++.m4 (~basic_symbol): b4_symbol_foreach works on yysym:
define it.
* tests/c++.at (Variants): Check it.
This commit is contained in:
Akim Demaille
2015-01-09 12:01:22 +01:00
parent e1d06b5235
commit ee028dceff
4 changed files with 41 additions and 10 deletions

View File

@@ -346,6 +346,7 @@ m4_define([b4_public_types_define],
{]b4_variant_if([[
// User destructor.
symbol_number_type yytype = this->type_get ();
basic_symbol<Base>& yysym = *this;
switch (yytype)
{
]b4_symbol_foreach([b4_symbol_destructor])dnl