Boost logo

Boost :

Subject: Re: [boost] [Proto] Errors due to narrowing conversions in matches.hpp
From: Eric Niebler (eric_at_[hidden])
Date: 2012-04-21 21:47:49

Peter, can you comment?

On 4/21/2012 1:14 PM, Michel Morin wrote:
> Some tests of Boost.Phoenix fail on clang trunk in a C++11 mode
> due to narrowing conversions of non-type template arguments,
> which are prohibited in C++11.

Really?! Wow, that's a breaking change I hadn't heard of before.

> Specifically, the narrowing conversions occur at Line 354 and 363
> in boost/proto/matches.hpp.
> They can be simply resolved using `static_cast<bool>(...)`.

I can certainly add the static_cast, but it looks like this may in fact
be a "bug" in boost::is_placeholder, which is defined as:

template< class T > struct is_placeholder
    enum _vt { value = 0 };

Ideally, this should be a valid MPL Integral Constant of type bool, like:

template< class T >
struct is_placeholder
  : mpl::false_

If that is not portable enough, it could be:

template< class T > struct is_placeholder
    BOOST_STATIC_CONSTANT(bool, value = false);

Peter, do you prefer one or the other, or is there some reason you'd
like to stick with the original formulation?

Eric Niebler
BoostPro Computing

Boost list run by bdawes at, gregod at, cpdaniel at, john at