In bison 3.2.3, given a parser definition that starts like this: %require "3.0.2" %defines %define parser_class_name {RezParser} %skeleton "lalr1.cc"
%locations; %define api.token.constructor %define api.value.type variant %define parse.assert %token<int> INTLIT; //… the following code crashes: std::string filename = "foo"; yy::location loc(&filename, 0,0); auto sym = RezParser::make_INTLIT(42, loc); auto sym2 = std::move(sym); Assertion failed: (yytypeid_), function as, file /Users/wolfgang/Projects/Retro68-build/build-host/Rez/RezParser.generated.hh, line 370. The reason is that variant::destroy<int> gets called twice. When basic_symbol<by_type>::move is used, variant::move is invoked, which destroys the source, and by_type::move is invoked, which resets the source’s type to empty. When basic_symbol’s move constructor is used, variant::move is invoked as well, but by_type’s constructor is used. Because by_type has no move constructor, it never resets the source object’s type to empty, and so the variant will be desrtroyed again when basic_symbol’s destructor is invoked. Suggested fix: by_type needs a move constructor that acts like by_type::move. I also suggest that the fact that yy:: parser_class_name::symbol_type is no longer copy-constructible in bison 3.2 should be listed as a breaking change from bison 3.0. Cheers, Wolfgang