Opened 8 years ago

Last modified 8 years ago

#10864 new Bugs

Boost 1.57 + Xcode 6: function/lamba incompatibility

Reported by: nat@… Owned by: No-Maintainer
Milestone: To Be Determined Component: lambda
Version: Boost 1.57.0 Severity: Regression
Keywords: Cc:

Description

Boost 1.57 and clang 6 (from Xcode 6) reject this program:

#include <iostream>
#include <boost/lambda/lambda.hpp>
#include <boost/function.hpp>

typedef boost::function<void(std::ostream&)> Streamer;

void out(const Streamer& func)
{
    func(std::cout);
}

int main(int argc, char *argv[])
{
    out(boost::lambda::_1 << "hi there\n");
    return 0;
}

Errors start with:

boost/lambda/detail/lambda_traits.hpp:256:58: error: cannot form a reference to 'void'
      typename detail::IF<boost::is_function<T>::value, T&, const T>::RET
                                                         ^

This works with Boost 1.55 with clang 6.

This works with Boost 1.57 with older compilers.

Change History (1)

comment:1 by nat@…, 8 years ago

The following is a viable workaround:

#include <iostream>
#include <boost/phoenix/core/argument.hpp>
#include <boost/phoenix/operator/bitwise.hpp>
#include <boost/function.hpp>

typedef boost::function<void(std::ostream&)> Streamer;

void out(const Streamer& func)
{
    func(std::cout);
}

int main(int argc, char *argv[])
{
    out(boost::phoenix::placeholders::arg1 << "hi there\n");
    return 0;
}
Note: See TracTickets for help on using tickets.