Hi, I've found out that Bison 3.0.4 parser crashes when you attempt to throw syntax_error from any mid-rule action of C++ parser, which uses location tracking. Here's a simple example:
%code provides { int yylex(yy::parser::semantic_type* type, const yy::parser::location_type* loc); } %require "3.0.4" %language "C++" %skeleton "lalr1.cc" %locations %define api.value.type {int} %% start: '1' '2' '3' { throw syntax_error(@1, "Test"); } '4' '5' '6' { $$ = 0; } ; %% void yy::parser::error(const yy::parser::location_type& loc, const std::string& message) { std::cout << message << std::endl; } int yylex(yy::parser::semantic_type* type, const yy::parser::location_type* loc) { static int start = '0'; return ++start; } int main() { yy::parser().parse(); } The crash occurs in yyerrorlab, when trying to do something with locations, in the following autogenerated line: yyerror_range[1].location = yystack_[yylen - 1].location; // <- crash, as yylen = 0 here Fortunately, there's an easy workaround for this bug: it's possible to move mid-rule action to another rule, and the issue doesn't reproduce anymore: start: one_two_three '4' '5' '6' { $$ = 0; } ; one_two_three: '1' '2' '3' { throw syntax_error(@1, "Test"); } ; And a small another bug: it's currently not possible to use syntax_error class from outside grammar file, as it has inline constructor defined (c++.m4), which makes this class non-constructible from other cpp files, at least in Visual Studio 2015. Removing "inline" keyword solves this issue.