Boost C++ Libraries: Ticket #11889: BOOST_DATA_TEST_CASE fails to compile for 4D and higher dimensional grids https://svn.boost.org/trac10/ticket/11889 <p> Compiling the following code with GCC 5.3.0 (C++11/14) I get an error on the second but not on the first test case. </p> <div class="wiki-code"><div class="code"><pre><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="k">using</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">xrange</span><span class="p">;</span> <span class="n">BOOST_DATA_TEST_CASE</span><span class="p">(</span><span class="n">Test_3D_grid</span><span class="p">,</span> <span class="n">xrange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="o">*</span> <span class="n">xrange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="o">*</span> <span class="n">xrange</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">,</span> <span class="n">c</span><span class="p">)</span> <span class="p">{}</span> <span class="n">BOOST_DATA_TEST_CASE</span><span class="p">(</span><span class="n">Test_4D_grid</span><span class="p">,</span> <span class="n">xrange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="o">*</span> <span class="n">xrange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="o">*</span> <span class="n">xrange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="o">*</span> <span class="n">xrange</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">d</span><span class="p">)</span> <span class="p">{}</span> </pre></div></div><p> The error reads </p> <pre class="wiki">/usr/include/boost/test/data/test_case.hpp:107:5: error: no matching function for call to 'bind(&lt;unresolved overloaded function type&gt;, const std::tuple&lt;int, int, int&gt;&amp;, const int&amp;)' BOOST_PP_REPEAT_FROM_TO(1, 4, TC_MAKE, _) </pre><p> Are four and more parameters not supported for data test cases? </p> <p> The documentation says </p> <blockquote class="citation"> <p> BOOST_DATA_TEST_CASE(test_case_name, dataset, var1, ..., varN) { /* datasets of arity N */ } </p> </blockquote> <p> without giving any limits on N. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11889 Trac 1.4.3 Martin Schulze <spam.martin.schulze@…> Wed, 06 Jan 2016 13:35:40 GMT attachment set https://svn.boost.org/trac10/ticket/11889 https://svn.boost.org/trac10/ticket/11889 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">reproduction.zip</span> </li> </ul> <p> Source and CMake file to reproduce error </p> Ticket Martin Schulze <spam.martin.schulze@…> Wed, 06 Jan 2016 13:35:49 GMT attachment set https://svn.boost.org/trac10/ticket/11889 https://svn.boost.org/trac10/ticket/11889 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">reproduction.2.zip</span> </li> </ul> <p> Source and CMake file to reproduce error </p> Ticket Martin Schulze <spam.martin.schulze@…> Wed, 06 Jan 2016 13:38:14 GMT <link>https://svn.boost.org/trac10/ticket/11889#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11889#comment:1</guid> <description> <p> The second attachment (reproduction.2.zip) can be ignored. Due to reloading the first got uploaded twice. I apologize for the inconvenience. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Raffi Enficiaud</dc:creator> <pubDate>Sat, 09 Jan 2016 14:36:24 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11889#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11889#comment:2</guid> <description> <p> You're correct, this piece of information is missing in the documentation. This fix is ready on the branch <code>topic/data-variadic-template</code> of boost.test. Can you please give a try? </p> </description> <category>Ticket</category> </item> <item> <author>Martin Schulze <spam.martin.schulze@…></author> <pubDate>Sat, 09 Jan 2016 16:15:34 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11889#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11889#comment:3</guid> <description> <p> I tried to set up modular boost and compile with that. The error message changed to </p> <pre class="wiki">/tmp/modular-boost/boost/test/data/for_each_sample.hpp:52:11: error: no match for call to '(const boost::unit_test::data::ds_detail::test_case_gen&lt; Test_4D_grid, boost::unit_test::data::monomorphic::grid&lt; boost::unit_test::data::monomorphic::grid&lt; boost::unit_test::data::monomorphic::grid&lt; boost::unit_test::data::monomorphic::generated_by&lt; boost::unit_test::data::monomorphic::xrange_t&lt;int, int&gt; &gt;, boost::unit_test::data::monomorphic::generated_by&lt; boost::unit_test::data::monomorphic::xrange_t&lt;int, int&gt; &gt; &gt;, boost::unit_test::data::monomorphic::generated_by&lt; boost::unit_test::data::monomorphic::xrange_t&lt;int, int&gt; &gt; &gt;, boost::unit_test::data::monomorphic::generated_by&lt; boost::unit_test::data::monomorphic::xrange_t&lt;int, int&gt; &gt; &gt; &gt;) (const int&amp;, const int&amp;, const int&amp;, const int&amp;)' action( std::get&lt;I&gt;(args)... ); /tmp/modular-boost/boost/test/data/test_case.hpp:100:13: note: candidate: template&lt;class Arg0&gt; void boost::unit_test::data::ds_detail::test_case_gen&lt;TestCase, DataSet&gt;::operator()(const Arg0&amp;) const [with Arg0 = Arg0; TestCase = Test_4D_grid; DataSet = boost::unit_test::data::monomorphic::grid&lt;boost::unit_test::data::monomorphic::grid&lt;boost::unit_test::data::monomorphic::grid&lt;boost::unit_test::data::monomorphic::generated_by&lt;boost::unit_test::data::monomorphic::xrange_t&lt;int, int&gt; &gt;, boost::unit_test::data::monomorphic::generated_by&lt;boost::unit_test::data::monomorphic::xrange_t&lt;int, int&gt; &gt; &gt;, boost::unit_test::data::monomorphic::generated_by&lt;boost::unit_test::data::monomorphic::xrange_t&lt;int, int&gt; &gt; &gt;, boost::unit_test::data::monomorphic::generated_by&lt;boost::unit_test::data::monomorphic::xrange_t&lt;int, int&gt; &gt; &gt;] void operator()( BOOST_PP_ENUM_BINARY_PARAMS(arity, Arg, const&amp; arg) ) const \ in expansion of macro ... /tmp/modular-boost/boost/test/data/test_case.hpp:107:5: note: in expansion of macro 'BOOST_PP_REPEAT_FROM_TO' BOOST_PP_REPEAT_FROM_TO(1, 4, TC_MAKE, _) ^ /tmp/modular-boost/boost/test/data/for_each_sample.hpp:52:11: note: candidate expects 1 argument, 4 provided action( std::get&lt;I&gt;(args)... ); /tmp/modular-boost/boost/test/data/test_case.hpp:100:13: note: candidate: template&lt;class Arg0, class Arg1&gt; void boost::unit_test::data::ds_detail::test_case_gen&lt;TestCase, DataSet&gt;::operator()(const Arg0&amp;, const Arg1&amp;) const [with Arg0 = Arg0; Arg1 = Arg1; TestCase = Test_4D_grid; DataSet = boost::unit_test::data::monomorphic::grid&lt;boost::unit_test::data::monomorphic::grid&lt;boost::unit_test::data::monomorphic::grid&lt;boost::unit_test::data::monomorphic::generated_by&lt;boost::unit_test::data::monomorphic::xrange_t&lt;int, int&gt; &gt;, boost::unit_test::data::monomorphic::generated_by&lt;boost::unit_test::data::monomorphic::xrange_t&lt;int, int&gt; &gt; &gt;, boost::unit_test::data::monomorphic::generated_by&lt;boost::unit_test::data::monomorphic::xrange_t&lt;int, int&gt; &gt; &gt;, boost::unit_test::data::monomorphic::generated_by&lt;boost::unit_test::data::monomorphic::xrange_t&lt;int, int&gt; &gt; &gt;] void operator()( BOOST_PP_ENUM_BINARY_PARAMS(arity, Arg, const&amp; arg) ) const \ in expansion of macro ... /tmp/modular-boost/boost/test/data/test_case.hpp:107:5: note: in expansion of macro 'BOOST_PP_REPEAT_FROM_TO' BOOST_PP_REPEAT_FROM_TO(1, 4, TC_MAKE, _) ^ tmp/modular-boost/boost/test/data/for_each_sample.hpp:52:11: note: candidate expects 2 arguments, 4 provided action( std::get&lt;I&gt;(args)... ); /tmp/modular-boost/boost/test/data/test_case.hpp:100:13: note: candidate: template&lt;class Arg0, class Arg1, class Arg2&gt; void boost::unit_test::data::ds_detail::test_case_gen&lt;TestCase, DataSet&gt;::operator()(const Arg0&amp;, const Arg1&amp;, const Arg2&amp;) const [with Arg0 = Arg0; Arg1 = Arg1; Arg2 = Arg2; TestCase = Test_4D_grid; DataSet = boost::unit_test::data::monomorphic::grid&lt;boost::unit_test::data::monomorphic::grid&lt;boost::unit_test::data::monomorphic::grid&lt;boost::unit_test::data::monomorphic::generated_by&lt;boost::unit_test::data::monomorphic::xrange_t&lt;int, int&gt; &gt;, boost::unit_test::data::monomorphic::generated_by&lt;boost::unit_test::data::monomorphic::xrange_t&lt;int, int&gt; &gt; &gt;, boost::unit_test::data::monomorphic::generated_by&lt;boost::unit_test::data::monomorphic::xrange_t&lt;int, int&gt; &gt; &gt;, boost::unit_test::data::monomorphic::generated_by&lt;boost::unit_test::data::monomorphic::xrange_t&lt;int, int&gt; &gt; &gt;] void operator()( BOOST_PP_ENUM_BINARY_PARAMS(arity, Arg, const&amp; arg) ) const \ /tmp/modular-boost/boost/test/data/test_case.hpp:107:5: note: in expansion of macro 'BOOST_PP_REPEAT_FROM_TO' BOOST_PP_REPEAT_FROM_TO(1, 4, TC_MAKE, _) ^ /tmp/modular-boost/boost/test/data/for_each_sample.hpp:52:11: note: candidate expects 3 arguments, 4 provided action( std::get&lt;I&gt;(args)... ); </pre><p> when compiling the code in the reproduction.zip </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Raffi Enficiaud</dc:creator> <pubDate>Sat, 09 Jan 2016 16:21:19 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11889#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11889#comment:4</guid> <description> <p> Thank you for your quick feedback, I will have a look into it. As a side note: this feature request was planned but as you may see it is not mature enough. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Raffi Enficiaud</dc:creator> <pubDate>Sat, 09 Jan 2016 17:28:58 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11889#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11889#comment:5</guid> <description> <p> I just pushed a change to this branch, would you please try again? </p> </description> <category>Ticket</category> </item> <item> <author>Martin Schulze <spam.martin.schulze@…></author> <pubDate>Sat, 09 Jan 2016 18:43:16 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11889#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11889#comment:6</guid> <description> <p> That one compiles. However, I cannot link for now (would have to build boost first), so there are no runtime results from my side yet. </p> <p> Btw. can't you test the code from reproduction.zip on your machine or did it already work? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Raffi Enficiaud</dc:creator> <pubDate>Sat, 09 Jan 2016 19:50:15 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11889#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11889#comment:7</guid> <description> <p> I created a similar test case in boost.test already (in the branch), and as for your specific example, you should not have any link issue since you are using the header only variant. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Raffi Enficiaud</dc:creator> <pubDate>Sat, 09 Jan 2016 19:51:28 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11889#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11889#comment:8</guid> <description> <p> The documentation entry for building boost.test, just in case: </p> <p> <a href="http://www.boost.org/doc/libs/master/libs/test/doc/html/boost_test/adv_scenarios/build_utf.html">http://www.boost.org/doc/libs/master/libs/test/doc/html/boost_test/adv_scenarios/build_utf.html</a> </p> </description> <category>Ticket</category> </item> <item> <author>Martin Schulze <spam.martin.schulze@…></author> <pubDate>Sun, 10 Jan 2016 09:23:31 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11889#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11889#comment:9</guid> <description> <blockquote class="citation"> <p> I created a similar test case in boost.test already (in the branch), </p> </blockquote> <p> So your tests passed but mine didn't? </p> <blockquote class="citation"> <p> you should not have any link issue since you are using the header only variant </p> </blockquote> <p> Yes, I wondered too, but now it is clear that I forgot <code>#define BOOST_TEST_MODULE</code>. After adding that, I got no more linker errors and the tests seem to run correctly. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Raffi Enficiaud</dc:creator> <pubDate>Sun, 10 Jan 2016 11:39:14 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11889#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11889#comment:10</guid> <description> <p> Perfect, this should be available for the next release. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Raffi Enficiaud</dc:creator> <pubDate>Sun, 10 Jan 2016 11:39:53 GMT</pubDate> <title>owner changed https://svn.boost.org/trac10/ticket/11889#comment:11 https://svn.boost.org/trac10/ticket/11889#comment:11 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Gennadiy Rozental</span> to <span class="trac-author">Raffi Enficiaud</span> </li> </ul> Ticket Raffi Enficiaud Sun, 10 Jan 2016 15:29:15 GMT status changed https://svn.boost.org/trac10/ticket/11889#comment:12 https://svn.boost.org/trac10/ticket/11889#comment:12 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket Raffi Enficiaud Tue, 12 Jan 2016 08:36:00 GMT milestone changed https://svn.boost.org/trac10/ticket/11889#comment:13 https://svn.boost.org/trac10/ticket/11889#comment:13 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.61.0</span> </li> </ul> Ticket Raffi Enficiaud Tue, 02 Feb 2016 08:23:15 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/11889#comment:14 https://svn.boost.org/trac10/ticket/11889#comment:14 <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> Commits: </p> <ul><li>8ed17b554df2eaf9dfa4849012dc19e150d4c23c </li><li>673c7aeb3932d67972659002b38b256d6cc4bdb3 </li><li>673c7aeb3932d67972659002b38b256d6cc4bdb3 </li><li>42de00192e0a2f1571d9025bf2207bf19540fe6f </li></ul><p> Merged in master: 2b918d0bd56cd2add28a1e35c6a2d0fd8c60cf90 </p> Ticket