Opened 2 years ago

Last modified 2 years ago

#12397 new Bugs

static_assert in arg.hpp failing when using boost::placeholder with std::bind

Reported by: anonymous Owned by: Peter Dimov
Milestone: To Be Determined Component: bind
Version: Boost 1.61.0 Severity: Regression
Keywords: Cc:

Description

In our project we currently use std::bind with boost::placeholers because boost::placeholders are already global namespace and some some of the dependency (header) libraries might depend on this so we can't use BOOST_BIND_NO_PLACEHOLDERS currently.

So we make boost::placeholers work with std::bin with this code:

namespace std {
	template<int N>
	struct is_placeholder<boost::arg<N>> : public integral_constant<int, N> {};
}

This worked fine, but since boost 1.60 when BOOST_CONSTEXPR was added to the boost::arg contructor the compliation fails for some of our developers with

error: static assertion failed: I == is_placeholder<T>::value
         BOOST_STATIC_ASSERT( I == is_placeholder<T>::value );

from arg.hpp

Attachments (1)

test_case.cpp (228 bytes) - added by loonycyborg 2 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 2 years ago by loonycyborg

I'm contributor to the same project(namely Battle for Wesnoth), and I got this issue on debian while using mingw-w64 cross toolchain(gcc 4.9). While my gentoo crossdev based cross toolchain(gcc5.3 and the same boost version) compiled same code without errors. atm I'm using 5.3.0 for native builds and not getting this issue there either.

comment:2 Changed 2 years ago by Peter Dimov

I'll look into this if someone can present a simple example that triggers the error.

Changed 2 years ago by loonycyborg

Attachment: test_case.cpp added

comment:3 Changed 2 years ago by loonycyborg

This compiles fine with gcc 5.4.0 but fails with gcc 4.8.5 and 4.9.3, using -std=c++11 option

Note: See TracTickets for help on using tickets.