Opened 9 years ago

Closed 8 years ago

#8774 closed Bugs (fixed)

use of dectype in result_of gives errors in spirit parser on gcc-4.8.1

Reported by: rodolfo@… Owned by: Joel de Guzman
Milestone: To Be Determined Component: spirit
Version: Boost 1.54.0 Severity: Regression
Keywords: Cc:

Description

The following snippet compiles and runs fine on boost-1.53 and earlier using gcc-4.8.1, but fails to compile on boost-1.54.

//#define BOOST_RESULT_OF_USE_TR1
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>

int main()
{

    namespace qi = boost::spirit::qi;
    qi::rule<const char *, void(int &)> foo = qi::int_[qi::_r1 = qi::_1];
    qi::rule<const char *, int()> start = foo(qi::_val);

    const char *beg = "5",
               *end = beg+strlen(beg);

    int val;
    if(parse(beg, end, start, val))
        std::cout << val << std::endl;
    else
        std::cout << "error";
}

The compile error output is attached to this ticket. The error goes away by uncommenting the first line.

It seems that boost-1.54 enables by default the use of decltype in the implementation of boost::result_of but it isn't doing what it's suppose to do.

Attachments (1)

errors.txt (31.8 KB ) - added by rodolfo@… 9 years ago.
gcc-4.8.1 compile output with errors

Download all attachments as: .zip

Change History (4)

by rodolfo@…, 9 years ago

Attachment: errors.txt added

gcc-4.8.1 compile output with errors

comment:1 by ttan@…, 9 years ago

Same here. my code that compiles OK with STL's distro9.2(gcc4.7.1 +boost 1.5.0) yields errors regarding result_of when compiling with distro 11.1(gcc 4.8.1 +boost 1.54). Adding -DBOOST_RESULT_OF_USE_TR1 to g++ fixes the problem.

comment:2 by anonymous, 8 years ago

This bug seems fixed in Boost 1.56.0. The above code compiles under RHEL 7 (gcc 4.8.2) in C++98 and C++11 mode.

comment:3 by Joel de Guzman, 8 years ago

Resolution: fixed
Status: newclosed

Confirmed. This has been fixed. I'm closing this now.

Note: See TracTickets for help on using tickets.