Opened 5 years ago

Closed 4 years ago

#13380 closed Bugs (fixed)

data-driven tests' join operator `+` corrupts first column

Reported by: Addy <aclaure@…> 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 bugs@…, 5 years ago

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

comment:3 by Raffi Enficiaud, 5 years ago

Thank you for the report, I'll have a look very soon.

comment:4 by Raffi Enficiaud, 4 years ago

Milestone: To Be DeterminedBoost 1.69
Owner: changed from Gennadiy Rozental to Raffi Enficiaud
Status: newassigned

comment:5 by Raffi Enficiaud, 4 years ago

In develop, rev 2fc875b9b22c717e17e56171501bd9aa3051213c

comment:6 by Raffi Enficiaud, 4 years ago

Resolution: fixed
Status: assignedclosed

In master, closing

Note: See TracTickets for help on using tickets.