Boost C++ Libraries: Ticket #7746: Copy without assign problem in find_iterator.hpp https://svn.boost.org/trac10/ticket/7746 <p> I have encountered some errors in Boost, while running some static analyzer tool. </p> <p> It is reported in boost/algorithm/string/find_iterator.hpp </p> <p> The error is: <strong>find_iterator and split_iterator classes has user-written copy constructor but no corresponding user-written assignment operator.</strong> </p> <p> I have attached a patch herewith. Is it valid to apply this fix? </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7746 Trac 1.4.3 Gaurav Gupta <g.gupta@…> Wed, 28 Nov 2012 11:34:42 GMT attachment set https://svn.boost.org/trac10/ticket/7746 https://svn.boost.org/trac10/ticket/7746 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">find_iterator.hpp_patch</span> </li> </ul> <p> Proposed patch </p> Ticket Marshall Clow Wed, 28 Nov 2012 14:54:25 GMT <link>https://svn.boost.org/trac10/ticket/7746#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7746#comment:1</guid> <description> <p> Do you have a sample program that fails to compile/misbehaves because there is no explicit assignment operator? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Wed, 28 Nov 2012 18:19:40 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7746#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7746#comment:2</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/81615" title="Added tests for assignment of Boost::find_iterator and split_iterator; ...">[81615]</a>) Added tests for assignment of Boost::find_iterator and split_iterator; Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7746" title="#7746: Bugs: Copy without assign problem in find_iterator.hpp (closed: invalid)">#7746</a> </p> </description> <category>Ticket</category> </item> <item> <author>Gaurav Gupta <g.gupta@…></author> <pubDate>Thu, 29 Nov 2012 05:28:02 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7746#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7746#comment:3</guid> <description> <p> Thanks for adding tests. I tried running my static analyzer tool (Coverity Prevent) on this test file and the tool is reporting the same errors. The patch I attached is no doubt, not a solution of this problem. So I want your feedback, whether this error should be fixed or assignment operator is left intentionally? If it is a bug, do we need to define a user-written assignment operator for it? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Thu, 29 Nov 2012 06:38:33 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7746#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7746#comment:4</guid> <description> <p> It doesn't appear to me that this is a bug. The compiler-generated assignment operator does the right thing. </p> <p> The only reason (that I can tell) for the user-defined copy constructor is to call a particular base-class constructor. </p> <p> I've never used Coverity on C++ code, but when I used it on C code (3 years ago), it had a very high false positive rate. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Mon, 10 Dec 2012 15:42:58 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/7746#comment:5 https://svn.boost.org/trac10/ticket/7746#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> Ticket