mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
When variant are enabled, the yylhs variable (the left-hand side of the rule being reduced, i.e. $$ and @$) is explicitly destroyed when YYERROR is called. This is because before running the user code, $$ is initialized, so that the user can properly use it. However, when quitting yyparse, yylhs is also reclaimed by the C++ compiler: the variable goes out of scope. Instead of trying to be too smart, let the compiler do its job: reduce the scope of yylhs to exactly the reduction. This way, whatever the type of scope exit (regular, exception, return, goto...) this variable will be properly reclaimed. Reported by Paolo Simone Gasparello. <http://lists.gnu.org/archive/html/bug-bison/2013-10/msg00003.html> * data/lalr1.cc (yyparse): Reduce the scope of yylhs. * tests/c++.at: We now pass this test.