Conversion Warning with GCC15 when using operator<< within custom failure message and -WConversion
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- cpp
- Domain
- testing-qa
Research direction
Start by reproducing the BOOST_TEST examples from the linked Boost.Test custom-messages documentation with GCC15 and -Wconversion, using the Compiler Explorer example as a reference. Trace the assertion and streamed-message conversion path; done means the examples retain their behavior without emitting the reported conversion warnings.
Written by the indexing model from the issue text.
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:
#define BOOST_TEST_MODULE boost_test_message
#include <boost/test/included/unit_test.hpp>
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);
}
Warning:
<source>: In member function 'void test_message::test_method()':
<source>:8:62: warning: choosing 'boost::test_tools::tt_detail::assertion_evaluate_t<E>::operator boost::test_tools::assertion_result() [with E = boost::test_tools::assertion::binary_expr<boost::test_tools::assertion::value_expr<const int&>, const int&, boost::test_tools::assertion::op::EQ<int, int, void> >]' over 'boost::test_tools::assertion_result::assertion_result(const BoolConvertable&) [with BoolConvertable = boost::test_tools::tt_detail::assertion_evaluate_t<boost::test_tools::assertion::binary_expr<boost::test_tools::assertion::value_expr<const int&>, const int&, boost::test_tools::assertion::op::EQ<int, int, void> > >]' [-Wconversion]
8 | BOOST_TEST(a == b, "a should be equal to b: " << a << "!=" << b);
| ^
<source>:8:62: warning: for conversion from 'boost::test_tools::tt_detail::assertion_evaluate_t<boost::test_tools::assertion::binary_expr<boost::test_tools::assertion::value_expr<const int&>, const int&, boost::test_tools::assertion::op::EQ<int, int, void> > >' to 'boost::test_tools::assertion_result' [-Wconversion]
<source>:8:62: note: because conversion sequence for the argument is better
- Dominant language
- C++
- Stars
- 213
- Forks
- 149
- Avg merge
- 18h 17m
- Merged PRs (30d)
- 2
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/test
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 42/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·