Opened 5 years ago
Closed 4 years ago
#13380 closed Bugs (fixed)
data-driven tests' join operator `+` corrupts first column
| Reported by: | Owned by: | Raffi Enficiaud | |
|---|---|---|---|
| Milestone: | Boost 1.69 | Component: | test |
| Version: | Boost 1.65.0 | Severity: | Problem |
| Keywords: | data-driven-tests join | Cc: |
Description
Consider the following code:
BOOST_DATA_TEST_CASE(
sampleTest,
(data::make(1) ^ data::make(2)) + (data::make(3) ^ data::make(4)),
var1,
var2)
{
std::cout << var1 << "," << var2 << std::endl;
}
The output I'd expect to see is:
1,2 3,4
However it appears that var1 gets corrupt:
$> ./MyTests --run_test=Tests/sampleTest Running 2 test cases... 202875304,2 202875304,4 *** No errors detected $> ./MyTests --run_test=Tests/sampleTest Running 2 test cases... 83976616,2 83976616,4 *** No errors detected
Change History (6)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
comment:4 by , 4 years ago
| Milestone: | To Be Determined → Boost 1.69 |
|---|---|
| Owner: | changed from to |
| Status: | new → assigned |
Note:
See TracTickets
for help on using tickets.

It doesn't "corrupt the first column". It invoked Undefined Behaviour.
Join iterator returns tuples, and they are temporaries. Analysis was done here: https://stackoverflow.com/questions/48102512/boosts-data-driven-tests-join-operator-corrupts-first-column