Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion include/boost/parser/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4587,7 +4587,13 @@ namespace boost { namespace parser {
!std::is_same_v<just_x, just_out>) &&
std::is_assignable_v<just_out &, just_x &&> &&
(!std::is_same_v<just_out, std::string> ||
!std::is_integral_v<just_x>)) {
!std::is_integral_v<just_x>) &&
(!std::is_integral_v<just_x> ||
(!std::is_same_v<just_out, std::u32string>
#if defined(__cpp_char8_t)
&& !std::is_same_v<just_out, std::u8string>
#endif
))) {
detail::assign(out, std::move(x));
} else {
detail::move_back(
Expand Down
43 changes: 43 additions & 0 deletions test/github_issues.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,48 @@ void github_issue_312()
BOOST_TEST(result.value()->evaluate() == ((2*0.1) + 33.) * (2 + 3) + 3.1415 * 2);
}

void github_issue_327()
{
namespace bp = boost::parser;
auto const chars = bp::char_ >> bp::char_;

{
std::u32string result;
bool const success = bp::parse(std::u32string{U"ab"}, chars, result);
BOOST_TEST(success);
BOOST_TEST(result == U"ab");
}
{
std::u32string result;
bool const success = bp::parse(std::string{"ab"}, chars, result);
BOOST_TEST(success);
BOOST_TEST(result == U"ab");
}
{
std::u32string const input{U"\u00e9\U0001F600"};
std::u32string result;
bool const success = bp::parse(input, chars, result);
BOOST_TEST(success);
BOOST_TEST(result == input);
}
{
std::u32string const input{U"\u00e9\U0001F600"};
std::string result;
bool const success = bp::parse(input, chars, result);
BOOST_TEST(success);
BOOST_TEST(result == "\xC3\xA9\xF0\x9F\x98\x80");
}
#if defined(__cpp_char8_t)
{
std::u32string const input{U"\u00e9\U0001F600"};
std::u8string result;
bool const success = bp::parse(input, chars, result);
BOOST_TEST(success);
BOOST_TEST(result == u8"\u00e9\U0001F600");
}
#endif
}


int main()
{
Expand All @@ -796,5 +838,6 @@ int main()
github_issue_294();
github_pr_297();
github_issue_312();
github_issue_327();
return boost::report_errors();
}
Loading