Opened 21 months ago

Closed 17 months ago

Last modified 17 months ago

#12241 closed Bugs (fixed)

Data-driven testing over a range of std::tuple has broken

Reported by: Tony Lewis <tonyelewis@…> Owned by: Raffi Enficiaud
Milestone: Boost 1.62.0 Component: test
Version: Boost 1.61.0 Severity: Regression
Keywords: test, tuple, data-driven, BOOST_DATA_TEST_CASE, std::tuple Cc:


The following code, which compiled and ran under Boost 1.60.0, fails to compile under Boost 1.61.0.

#define BOOST_TEST_MODULE boost_test_tuple_prob

#include <boost/test/included/unit_test.hpp>
#include <boost/test/data/test_case.hpp>
#include <boost/test/data/monomorphic.hpp>

#include <tuple>
#include <vector>

const std::vector< std::tuple<int, int>> values = {
        std::tuple<int, int>{  1, 11 },
        std::tuple<int, int>{  2, 12 },
        std::tuple<int, int>{  3, 13 },

BOOST_DATA_TEST_CASE( test1, boost::unit_test::data::make( values ), var1, var2 ) {
        std::cout << var1 << ", " << var2 << "\n";

The compilation error is around line 66 of boost/test/data/for_each_sample.hpp and it's complaining about tuple_size< const tuple<int, int> &> being an incomplete type. I think the problem is just that tuple_size doesn't work on a const reference type and this can be fixed by changing the T in that line to typename std::decay<T>::type.

If this sort of use of std::tuple isn't supported (see ticket:12240) then I think Boost Test should be fixed to allow the above code but without var2.

Attachments (0)

Change History (6)

comment:1 Changed 18 months ago by Raffi Enficiaud

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

comment:2 Changed 18 months ago by Raffi Enficiaud

Please give a try to the branch origin/topic/12241-datasets-on-tuples, thanks!

comment:3 Changed 18 months ago by Tony Lewis <tonyelewis@…>

Apologies for the delay; I've been away.

Yes - that works for me.

comment:4 Changed 18 months ago by Raffi Enficiaud

Good, this has been merged to master (rev 6abd34d) last week, should be in 1.62.

comment:5 Changed 17 months ago by Raffi Enficiaud

Resolution: fixed
Status: assignedclosed

Released in 1.62

comment:6 Changed 17 months ago by Tony Lewis <tonyelewis@…>

Yes - that works for me. Thanks very much for this work.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Raffi Enficiaud.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.