mirror of
https://github.com/autc04/Retro68.git
synced 2025-01-15 15:33:44 +00:00
work around bison 3.2 bug (fixes #72)
This commit is contained in:
parent
00471c6104
commit
7eced7335a
@ -118,7 +118,18 @@
|
||||
{
|
||||
public:
|
||||
RezSymbol() = default;
|
||||
RezSymbol(yy::RezParser::symbol_type&& x) : yy::RezParser::symbol_type(std::move(x)) {}
|
||||
|
||||
// Bison 3.2 has a bug in the move constructor for basic_symbol<by_type>.
|
||||
// Bison-generated code uses only basic_symbol<by_type>::move, which
|
||||
// works without crashing.
|
||||
RezSymbol(yy::RezParser::symbol_type&& x)
|
||||
{
|
||||
move(x);
|
||||
}
|
||||
RezSymbol(RezSymbol&& x)
|
||||
{
|
||||
move(x);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,28 @@ BOOST_AUTO_TEST_SUITE(LexSuite)
|
||||
BOOST_CHECK_EQUAL(t.token(), TOKEN); \
|
||||
} while(0)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(moveBisonSymbol)
|
||||
{
|
||||
// Bison 3.2 contains a bug in the move constructor for its symbol type.
|
||||
// It will crash when used.
|
||||
// Unfortunately, there is no copy constructor any more, so it's hard to avoid.
|
||||
std::string filename = "foo";
|
||||
yy::location loc(&filename, 0,0);
|
||||
auto sym = RezParser::make_INTLIT(42, loc);
|
||||
auto sym2 = std::move(sym);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(moveRezSymbol)
|
||||
{
|
||||
// This tests my workaround for the bison bug;
|
||||
// RezSymbol derives from bison's symbol type and reimplements all move constructors
|
||||
std::string filename = "foo";
|
||||
yy::location loc(&filename, 0,0);
|
||||
RezSymbol sym = RezParser::make_INTLIT(42, loc);
|
||||
auto sym2 = std::move(sym);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(basicInt)
|
||||
{
|
||||
RezWorld world;
|
||||
|
Loading…
x
Reference in New Issue
Block a user