Last active
August 22, 2016 17:37
-
-
Save peterhuene/2ce5e403bf313ffc3f9caaaac8461bef to your computer and use it in GitHub Desktop.
Spirit X3 1.61.0 error repro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <boost/spirit/home/x3.hpp> | |
#include <boost/fusion/include/std_pair.hpp> | |
using namespace std; | |
namespace x3 = boost::spirit::x3; | |
struct repro_string_parser : x3::parser<repro_string_parser> | |
{ | |
using attribute_type = string; | |
template <typename Iterator, typename Attribute> | |
bool parse(Iterator& first, Iterator const& last, x3::unused_type, x3::unused_type, Attribute& attr) const | |
{ | |
attr = "repro"; | |
return true; | |
} | |
}; | |
auto const repro_string = repro_string_parser{}; | |
struct repro_empty_parser : x3::parser<repro_empty_parser> | |
{ | |
using attribute_type = x3::unused_type; | |
template <typename Iterator, typename Attribute> | |
bool parse(Iterator& first, Iterator const& last, x3::unused_type, x3::unused_type, Attribute& attr) const | |
{ | |
return true; | |
} | |
}; | |
auto const repro_empty = repro_empty_parser{}; | |
x3::rule<class repro_tag, pair<string, string>> const repro_rule = "repro"; | |
auto const repro_rule_def = repro_string > repro_empty > repro_string; | |
BOOST_SPIRIT_DEFINE(repro_rule); | |
int main() | |
{ | |
string input = ""; | |
pair<string, string> result; | |
x3::parse(input.begin(), input.end(), repro_rule, result); | |
// Expected output: repro repro | |
cout << result.first << " " << result.second << endl; | |
return 0; | |
} |
@djowel I'm not sure if you saw my email on the Boost Spirit mailing list, but this break appears related to boostorg/spirit@a8e391b. Do you have any advice on how to fix this in the example parser with the x3::unused_type
attribute type? Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The above is to demonstrate a compilation error (at line 16) when compiled with Boost 1.61.0. The repro builds without error and produces the expected output with Boost 1.60.0.