Conversion Warning with GCC15 when using operator<< within custom failure message and -WConversion
- Dominant language
- C++
- Stars
- 213
- Forks
- 149
- Avg merge
- 18h 17m
- Merged PRs (30d)
- 2
Description
Starting with GCC15 ( when using -WConversion ) I get conversion warnings when using stream operator in custom failure messages.
Example code from the docs also produces those warnings:
[Boost Test](https://www.boost.org/doc/libs/1_88_0/libs/test/doc/html/boost_test/testing_tools/reports.html#boost_test.testing_tools.reports.custom_messages)
```
#define BOOST_TEST_MODULE boost_test_message
#include
BOOST_AUTO_TEST_CASE( test_message )
{
const int a(1), b(2);
BOOST_TEST(a == b, "a should be equal to b: " << a << "!=" << b);
BOOST_TEST(a != 10, "value of a=" << a);
}
```
[Compiler Explorer Example](https://compiler-explorer.com/z/3zMWcsPEh)
Warning:
```
: In member function 'void test_message::test_method()':
:8:62: warning: choosing 'boost::test_tools::tt_detail::assertion_evaluate_t::operator boost::test_tools::assertion_result() [with E = boost::test_tools::assertion::binary_expr, const int&, boost::test_tools::assertion::op::EQ >]' over 'boost::test_tools::assertion_result::assertion_result(const BoolConvertable&) [with BoolConvertable = boost::test_tools::tt_detail::assertion_evaluate_t, const int&, boost::test_tools::assertion::op::EQ > >]' [-Wconversion]
8 | BOOST_TEST(a == b, "a should be equal to b: " << a << "!=" << b);
| ^
:8:62: warning: for conversion from 'boost::test_tools::tt_detail::assertion_evaluate_t, const int&, boost::test_tools::assertion::op::EQ > >' to 'boost::test_tools::assertion_result' [-Wconversion]
:8:62: note: because conversion sequence for the argument is better
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.