[Boost-bugs] [Boost C++ Libraries] #12241: Data-driven testing over a range of std::tuple has broken

Subject: [Boost-bugs] [Boost C++ Libraries] #12241: Data-driven testing over a range of std::tuple has broken
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-05-31 14:12:16


#12241: Data-driven testing over a range of std::tuple has broken
-------------------------------------------------+-------------------------
 Reporter: Tony Lewis <tonyelewis@…> | Owner: rogeeff
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: test
  Version: Boost 1.61.0 | Severity: Regression
 Keywords: test,tuple,data- |
  driven,BOOST_DATA_TEST_CASE,std::tuple |
-------------------------------------------------+-------------------------
 The following code, which compiled and ran under Boost 1.60.0, fails to
 compile under Boost 1.61.0.

 {{{
 #!cpp
 #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`.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12241>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC