2
0
mirror of https://github.com/boostorg/parser.git synced 2026-01-30 20:12:23 +00:00

Fix an error in seq_parser when a non-attribute parser fails internally, after

the successful parse of an adjacent attribute-generating parser.  Since the
non-attribute parser points to the same spot in the output tuple, if the
non-attribute parser fails internally, it is likely to do "out_attr =
decltype(out_attr)()", which erases the previous seuccessfully generated
attribute.
This commit is contained in:
Zach Laine
2024-02-22 00:09:29 -06:00
parent 3487211426
commit 63884d2efa
2 changed files with 12 additions and 1 deletions

View File

@@ -2167,6 +2167,13 @@ TEST(parser, combined_seq_and_or)
EXPECT_EQ(chars, "xyz");
}
}
{
constexpr auto parser = int_ >> -(lit('a') | 'b');
auto result = parse("34b", parser);
EXPECT_TRUE(result);
EXPECT_EQ(*result, 34);
}
}
TEST(parser, eol_)