boostorg / boostorg/type_traits
boost::has_left_shift does not work with containers
- Dominant language
- C++
- Stars
- 66
- Forks
- 87
- PR merge metrics
- No merged PRs in 30d
Description
The following example is a minimal reproduction of this issue:
```cpp
#define BOOST_TEST_MODULE ExampleTestModule
#include
#include
inline std::ostream& operator<<(std::ostream& os, const std::pair& _) {
os << "Pairwise operator called!" << std::endl;
return os;
}
BOOST_STATIC_ASSERT(boost::has_left_shift&>::value);
// If you comment out the above static assertion, the code compiles and this
// test case prints, as expected "Pairwise operator called!"
BOOST_AUTO_TEST_CASE(test_case1)
{
std::pair pair;
std::cout << pair;
}
```
Compiling with gcc 14.2.1 results in:
```
ex.cpp:10:87: error: static assertion failed: boost::has_left_shift&>::value
10 | BOOST_STATIC_ASSERT(boost::has_left_shift&>::value);
```
I have similar results in clang 18.1.6:
```
ex.cpp:10:21: error: static assertion failed due to requirement 'boost::has_left_shift> &, const std::pair &, boost::binary_op_detail::dont_care>::value': boost::has_left_shift&>::value
10 | BOOST_STATIC_ASSERT(boost::has_left_shift&>::value);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/boost/static_assert.hpp:71:55: note: expanded from macro 'BOOST_STATIC_ASSERT'
71 | # define BOOST_STATIC_ASSERT( ... ) static_assert(__VA_ARGS__, #__VA_ARGS__)
|
```
The same happens if you use a `std::vector` instead.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.