Boost logo

Boost Users :

Subject: [Boost-users] Error building Spirit parser in VS2017
From: Michael Powell (mwpowellhtx_at_[hidden])
Date: 2018-10-30 23:20:11


I am receiving the following error building against the latest VS2017 ...

error C4996: 'std::fpos<_Mbstatet>::seekpos': warning STL4019: The
member std::fpos::seekpos() is non-Standard, and is preserved only for
compatibility with workarounds for old versions of Visual C++. It will
be removed in a future release, and in this release always returns 0.
Please use standards-conforming mechanisms to manipulate fpos, such as
conversions to and from streamoff, or an integral type, instead. If
you are receiving this message while compiling Boost.IOStreams, a fix
has been submitted upstream to make Boost use standards-conforming
mechanisms, as it does for other compilers. You can define
received this warning, or define _REMOVE_FPOS_SEEKPOS to remove
std::fpos::seekpos entirely.
1>c:\program files (x86)\microsoft visual
note: see declaration of 'std::fpos<_Mbstatet>::seekpos'

With my grammar:

BOOST_FUSION_ADAPT_STRUCT(NS_VERSION_H::version, _major, _minor,
_patch, _build);

template <typename It>
struct version_parser : qi::grammar<It, NS_VERSION_H::version()> {

    version_parser() : dot_('.'), version_parser::base_type(_start) {
        using qi::lit;
        using qi::hold;
        using qi::short_;
        _major_part = short_;
        _minor_part = lit(dot_) >> short_;
        _patch_part = lit(dot_) >> short_;
        _build_part = lit(dot_) >> short_;
        _start = hold[_major_part >> _minor_part >> -(_patch_part >>


    qi::rule<It, NS_VERSION_H::version()> _start;
    const char dot_;
    qi::rule<It, short()> _major_part;
    qi::rule<It, short()> _minor_part;
    qi::rule<It, short()> _patch_part;
    qi::rule<It, short()> _build_part;

bool try_parse_version(const std::string& s, NS_VERSION_H::version& v) {
    using It = std::string::const_iterator;
    using qi::parse;

    It first = s.begin(), last = s.end();

    if (!parse(first, last, version_parser<It>{}, v)) {
        std::cout << "Failed to parse: '" << s << "'" << std::endl;
        return false;

    const auto dot_ = ".";

    std::cout << "version: "
        << v._major
        << dot_ << v._minor
        << dot_ << v._patch
        << dot_ << v._build << std::endl;

    return true;

At present I have not furnished any Spirit flags or anything of that
sort; pretty much taking the includes, grammar, building as-is.

Secondary to the error, I want the parser to reject spaces, should
just be numeric (short) and the dot delimiter.

Best regards,

Michael Powell

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at