Boost C++ Libraries: Ticket #13181: Boost test can't compare classes which have begin and end but not const_iterator https://svn.boost.org/trac10/ticket/13181 <p> The following code: </p> <pre class="wiki">struct s { const int *begin() const; const int *end() const; }; bool operator==(s,s); std::ostream &amp;operator&lt;&lt;(std::ostream &amp;out, s); BOOST_AUTO_TEST_CASE(foo) { s s1; s s2; BOOST_TEST(s1==s2); } </pre><p> When compiled in C++14 mode by gcc or clang, fails because <code>s</code> does not contain member types <code>const_iterator</code> and <code>value_type</code>. This works in C++03 mode, and it worked with boost 1.64. </p> <p> The attached patch fixes the issue. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13181 Trac 1.4.3 marc@… Tue, 29 Aug 2017 19:48:51 GMT attachment set https://svn.boost.org/trac10/ticket/13181 https://svn.boost.org/trac10/ticket/13181 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-test.diff</span> </li> </ul> Ticket Raffi Enficiaud Tue, 29 Aug 2017 21:34:44 GMT owner, status changed https://svn.boost.org/trac10/ticket/13181#comment:1 https://svn.boost.org/trac10/ticket/13181#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> </ul> <p> Thanks for the report and the patch, will apply for 1.66. A couple of questions: </p> <ul><li>when you say "fails because s does not contain member types ...", does it mean compilation failure or test failure? </li><li>in 1.65, the behaviour changed to check only for the existence of begin/end, while up to 1.64, it was required to have also <code>value_type</code> and <code>const_iterator</code> (as well as <code>size</code>). In your case, that would mean that your class will switch to the collection comparison, while you are providing <code>operator==</code> and I guess you expect that this operator will be used. What is your suggestion? </li></ul><p> As a workaround, does this </p> <pre class="wiki">BOOST_TEST((s1==s2)); </pre><p> work as you expect? </p> Ticket Raffi Enficiaud Tue, 29 Aug 2017 21:38:50 GMT milestone changed https://svn.boost.org/trac10/ticket/13181#comment:2 https://svn.boost.org/trac10/ticket/13181#comment:2 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.66.0</span> </li> </ul> Ticket marc@… Wed, 30 Aug 2017 14:24:40 GMT <link>https://svn.boost.org/trac10/ticket/13181#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13181#comment:3</guid> <description> <ol><li>I mean compilation failure. </li></ol><ol start="2"><li>I would prefer doing collection comparison for the better test failure messages, but it's fine if it uses the user-provided equality operator. </li></ol><p> The workaround does work. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Raffi Enficiaud</dc:creator> <pubDate>Wed, 06 Sep 2017 10:32:35 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/13181#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13181#comment:4</guid> <description> <p> Merged to branch <code>topic/13181-collection-compare-missing-typename</code>, but tests are failing, I will check </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Raffi Enficiaud</dc:creator> <pubDate>Sun, 12 Nov 2017 15:59:26 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/13181#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13181#comment:5</guid> <description> <p> Building now </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Raffi Enficiaud</dc:creator> <pubDate>Thu, 18 Jan 2018 14:21:08 GMT</pubDate> <title>milestone changed https://svn.boost.org/trac10/ticket/13181#comment:6 https://svn.boost.org/trac10/ticket/13181#comment:6 <ul> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.66.0</span> → <span class="trac-field-new">Boost 1.67.0</span> </li> </ul> Ticket Raffi Enficiaud Mon, 12 Feb 2018 08:18:30 GMT status, type changed; resolution set https://svn.boost.org/trac10/ticket/13181#comment:7 https://svn.boost.org/trac10/ticket/13181#comment:7 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>type</strong> <span class="trac-field-old">Bugs</span> → <span class="trac-field-new">Feature Requests</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> In master </p> Ticket