Boost C++ Libraries: Ticket #12241: Data-driven testing over a range of std::tuple has broken https://svn.boost.org/trac10/ticket/12241 <p> The following code, which compiled and ran under Boost 1.60.0, fails to compile under Boost 1.61.0. </p> <div class="wiki-code"><div class="code"><pre><span class="cp">#define BOOST_TEST_MODULE boost_test_tuple_prob</span> <span class="cp">#include</span> <span class="cpf">&lt;boost/test/included/unit_test.hpp&gt;</span><span class="cp"></span> <span class="cp">#include</span> <span class="cpf">&lt;boost/test/data/test_case.hpp&gt;</span><span class="cp"></span> <span class="cp">#include</span> <span class="cpf">&lt;boost/test/data/monomorphic.hpp&gt;</span><span class="cp"></span> <span class="cp">#include</span> <span class="cpf">&lt;tuple&gt;</span><span class="cp"></span> <span class="cp">#include</span> <span class="cpf">&lt;vector&gt;</span><span class="cp"></span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">tuple</span><span class="o">&lt;</span><span class="kt">int</span><span class="p">,</span> <span class="kt">int</span><span class="o">&gt;&gt;</span> <span class="n">values</span> <span class="o">=</span> <span class="p">{</span> <span class="n">std</span><span class="o">::</span><span class="n">tuple</span><span class="o">&lt;</span><span class="kt">int</span><span class="p">,</span> <span class="kt">int</span><span class="o">&gt;</span><span class="p">{</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">11</span> <span class="p">},</span> <span class="n">std</span><span class="o">::</span><span class="n">tuple</span><span class="o">&lt;</span><span class="kt">int</span><span class="p">,</span> <span class="kt">int</span><span class="o">&gt;</span><span class="p">{</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">12</span> <span class="p">},</span> <span class="n">std</span><span class="o">::</span><span class="n">tuple</span><span class="o">&lt;</span><span class="kt">int</span><span class="p">,</span> <span class="kt">int</span><span class="o">&gt;</span><span class="p">{</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">13</span> <span class="p">},</span> <span class="p">};</span> <span class="n">BOOST_DATA_TEST_CASE</span><span class="p">(</span> <span class="n">test1</span><span class="p">,</span> <span class="n">boost</span><span class="o">::</span><span class="n">unit_test</span><span class="o">::</span><span class="n">data</span><span class="o">::</span><span class="n">make</span><span class="p">(</span> <span class="n">values</span> <span class="p">),</span> <span class="n">var1</span><span class="p">,</span> <span class="n">var2</span> <span class="p">)</span> <span class="p">{</span> <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="n">var1</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;, &quot;</span> <span class="o">&lt;&lt;</span> <span class="n">var2</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">;</span> <span class="p">}</span> </pre></div></div><p> The compilation error is around line 66 of <code>boost/test/data/for_each_sample.hpp</code> and it's complaining about <code>tuple_size&lt; const tuple&lt;int, int&gt; &amp;&gt;</code> being an incomplete type. I think the problem is just that <code>tuple_size</code> doesn't work on a const reference type and this can be fixed by changing the <code>T</code> in that line to <code>typename std::decay&lt;T&gt;::type</code>. </p> <p> If this sort of use of <code>std::tuple</code> isn't supported (see <a class="assigned ticket" href="https://svn.boost.org/trac10/ticket/12240" title="#12240: Feature Requests: Documentation for data-driven testing should explictly mention std::tuple (assigned)">ticket:12240</a>) then I think Boost Test should be fixed to allow the above code but without <code>var2</code>. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12241 Trac 1.4.3 Raffi Enficiaud Mon, 05 Sep 2016 21:50:29 GMT owner, status, milestone changed https://svn.boost.org/trac10/ticket/12241#comment:1 https://svn.boost.org/trac10/ticket/12241#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Gennadiy Rozental</span> to <span class="trac-author">Raffi Enficiaud</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.62.0</span> </li> </ul> Ticket Raffi Enficiaud Mon, 05 Sep 2016 23:22:47 GMT <link>https://svn.boost.org/trac10/ticket/12241#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12241#comment:2</guid> <description> <p> Please give a try to the branch origin/topic/12241-datasets-on-tuples, thanks! </p> </description> <category>Ticket</category> </item> <item> <author>Tony Lewis <tonyelewis@…></author> <pubDate>Tue, 13 Sep 2016 21:04:39 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12241#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12241#comment:3</guid> <description> <p> Apologies for the delay; I've been away. </p> <p> Yes - that works for me. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Raffi Enficiaud</dc:creator> <pubDate>Tue, 13 Sep 2016 21:29:12 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12241#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12241#comment:4</guid> <description> <p> Good, this has been merged to master (rev 6abd34d) last week, should be in 1.62. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Raffi Enficiaud</dc:creator> <pubDate>Thu, 29 Sep 2016 13:41:36 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/12241#comment:5 https://svn.boost.org/trac10/ticket/12241#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Released in 1.62 </p> Ticket Tony Lewis <tonyelewis@…> Mon, 03 Oct 2016 12:50:28 GMT <link>https://svn.boost.org/trac10/ticket/12241#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12241#comment:6</guid> <description> <p> Yes - that works for me. Thanks very much for this work. </p> </description> <category>Ticket</category> </item> </channel> </rss>