HI In bison 3.0.4, the %destructor seems to be called even in the normal parse
we have discussion at help-bison mailing list. The thread started at: http://lists.gnu.org/archive/html/help-bison/2016-08/msg00014.html more verbose ouput details is at: http://lists.gnu.org/archive/html/help-bison/2016-08/msg00016.html but briefly, in the generated parser.cpp: #line 1038 "filter_parser.cpp" // lalr1.cc:859 YY_REDUCE_PRINT (yyn); try { switch (yyn) { .... default: break; } } catch (const syntax_error& yyexc) { error (yyexc); YYERROR; } YY_SYMBOL_PRINT ("-> $$ =", yylhs); yypop_ (yylen); yylen = 0; YY_STACK_PRINT (); in the generated : filter_parser.hh /// Stack type. typedef stack<stack_symbol_type> stack_type; /// The stack. stack_type yystack_; filter_parser::basic_symbol<Base>::clear () { ... basic_symbol<Base>& yysym = *this; (void) yysym; switch (yytype) { case 25: // PROG #line 159 "filter_parser.yy" // lalr1.cc:377 { std::cout << " **** I am PROG " << yysym.value.template as< PROG*>* () ;* delete $$; std::cout << " delete done" << std::endl; } even in the normal case ( no error recovery ), the call flow will go to: yypop_ (yylen) -> yystack_.pop (n) -> basic_symbol<Base>::clear () -> call %destructor code Could someone check it? thanks. min
