Boost C++ Libraries: Ticket #4919: gil_concept.hpp triggers self-assignment warnings https://svn.boost.org/trac10/ticket/4919 <p> boost/gil/gil_concept.hpp contains several instances of assigning a variable to itself. In context, this is perfectly safe (since the code should never actually be executed), but it nonetheless triggers gcc's -Wself-assign, cluttering the build output for those who have that flag set, and breaking the build for those who also set -Werror. </p> <p> I am unable to suggest a fix for the instance in PointNDConcept, because the line in question ("point<a class="missing changeset" title="No changeset 0 in the repository">[0]</a> = point<a class="missing changeset" title="No changeset 0 in the repository">[0]</a>;", line 276) appears to be checking properties that are not part of the concept as documented; I can find no documentation of the fact that models of PointNDConcept are expected to have an operator[], much less what the parameter and return types of that operator are. </p> <p> The attached patch contains trivial fixes for the other instances, which I believe have no impact on correctness or performance. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4919 Trac 1.4.3 gromer@… Wed, 01 Dec 2010 21:08:18 GMT attachment set https://svn.boost.org/trac10/ticket/4919 https://svn.boost.org/trac10/ticket/4919 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">selfassign.patch</span> </li> </ul> <p> Partial fix for the bug </p> Ticket Vicente Botet <vicente.botet@…> Tue, 07 Dec 2010 17:21:59 GMT type changed https://svn.boost.org/trac10/ticket/4919#comment:1 https://svn.boost.org/trac10/ticket/4919#comment:1 <ul> <li><strong>type</strong> <span class="trac-field-old">Bugs</span> → <span class="trac-field-new">Patches</span> </li> </ul> Ticket gromer@… Tue, 14 Dec 2010 20:30:06 GMT <link>https://svn.boost.org/trac10/ticket/4919#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4919#comment:2</guid> <description> <p> Please note that the attached patch does not completely resolve the issue; as noted in the summary I do not know what the correct resolution is for the self-assignment in PointNDConcept, because either the code is incorrect or the documentation is incomplete, and I don't know which. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Dean Michael Berris</dc:creator> <pubDate>Wed, 07 Nov 2012 03:53:16 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4919#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4919#comment:3</guid> <description> <p> Any updates on this? Can we remove the self-assignment check in the concept instead completely? There are other ways to test for assignable which doesn't involve self-assignment. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Dean Michael Berris</dc:creator> <pubDate>Wed, 14 Nov 2012 10:59:27 GMT</pubDate> <title>owner changed https://svn.boost.org/trac10/ticket/4919#comment:4 https://svn.boost.org/trac10/ticket/4919#comment:4 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Hailin Jin</span> to <span class="trac-author">Marshall Clow</span> </li> </ul> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/4919#comment:2" title="Comment 2">gromer@…</a>: </p> <blockquote class="citation"> <p> Please note that the attached patch does not completely resolve the issue; as noted in the summary I do not know what the correct resolution is for the self-assignment in PointNDConcept, because either the code is incorrect or the documentation is incomplete, and I don't know which. </p> </blockquote> <p> Okay, I had a look at this and it seems that PointNDConcept&lt;T&gt; does imply that it should be Regular&lt;T&gt;. This means it supports all the regular type requirements. </p> <p> Because this is a concept check it means whatever is in the concept definition determines the requirements. I'm inclined to think that merely switching the assignment to: </p> <pre class="wiki">value_type v = p[0]; p[0] = v; </pre><p> Should fix the issue properly. I'll attach a new patch that should fix this. </p> Ticket Dean Michael Berris Wed, 14 Nov 2012 11:24:11 GMT <link>https://svn.boost.org/trac10/ticket/4919#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4919#comment:5</guid> <description> <p> Also, as an addendum, the concept does require that the type T has a subscript operator, as this deals with axes of a Point. Subsequent Point*DConcept tests that depend on PointNDConcept where subscripting is required. In my patch I have updated the concept documentation to reflect this. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Dean Michael Berris</dc:creator> <pubDate>Mon, 19 Nov 2012 00:18:16 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/4919 https://svn.boost.org/trac10/ticket/4919 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-gil-self-assignment-fix.patch</span> </li> </ul> <p> Updated documentation and self-assignments. </p> Ticket Dean Michael Berris Mon, 19 Nov 2012 00:19:12 GMT <link>https://svn.boost.org/trac10/ticket/4919#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4919#comment:6</guid> <description> <p> Apologies for the delay. Marshall, would you mind having a look at the updated patch? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Mon, 17 Dec 2012 18:00:53 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4919#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4919#comment:7</guid> <description> <p> I spoke to Lubomir, and he said: </p> <p> "PointNDConcept is an N-dimensional point where each dimension may have a different type. Therefore it cannot have operator[]. So the documentation is correct and the line point<a class="missing changeset" title="No changeset 0 in the repository">[0]</a> = point<a class="missing changeset" title="No changeset 0 in the repository">[0]</a> should be removed." </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Tue, 18 Dec 2012 15:15:10 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/4919 https://svn.boost.org/trac10/ticket/4919 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">gil.patch</span> </li> </ul> <p> Revised GIL self-assignment patch </p> Ticket Dean Michael Berris Wed, 19 Dec 2012 04:36:29 GMT <link>https://svn.boost.org/trac10/ticket/4919#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4919#comment:8</guid> <description> <p> Okay, this looks and sounds good to me! Can we commit this change and perhaps get this to a release branch too? :) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Wed, 19 Dec 2012 05:09:08 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4919#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4919#comment:9</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/82092" title="Apply patch for Lubomir; Refs #4919">[82092]</a>) Apply patch for Lubomir; Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4919" title="#4919: Patches: gil_concept.hpp triggers self-assignment warnings (closed: fixed)">#4919</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Dean Michael Berris</dc:creator> <pubDate>Wed, 14 Aug 2013 02:53:14 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4919#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4919#comment:10</guid> <description> <p> Can we get an update on when <a class="changeset" href="https://svn.boost.org/trac10/changeset/82092" title="Apply patch for Lubomir; Refs #4919">[82092]</a> will make it into a release? 1.54.0 still doesn't have this IIUC. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Mateusz Loskot</dc:creator> <pubDate>Thu, 16 Feb 2017 10:53:53 GMT</pubDate> <title>cc set https://svn.boost.org/trac10/ticket/4919#comment:11 https://svn.boost.org/trac10/ticket/4919#comment:11 <ul> <li><strong>cc</strong> <span class="trac-author">mateusz@…</span> added </li> </ul> Ticket Stefan Seefeld Sat, 01 Jul 2017 21:13:12 GMT owner changed https://svn.boost.org/trac10/ticket/4919#comment:12 https://svn.boost.org/trac10/ticket/4919#comment:12 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Marshall Clow</span> to <span class="trac-author">Stefan Seefeld</span> </li> </ul> Ticket Mateusz Loskot Sat, 25 Aug 2018 15:53:09 GMT status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/4919#comment:13 https://svn.boost.org/trac10/ticket/4919#comment:13 <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">fixed</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.68.0</span> </li> </ul> <p> The patch was released in GIL with Boost 1.68 </p> <p> <a class="ext-link" href="https://github.com/boostorg/gil/blob/boost-1.67.0/include/boost/gil/gil_concept.hpp"><span class="icon">​</span>https://github.com/boostorg/gil/blob/boost-1.67.0/include/boost/gil/gil_concept.hpp</a> </p> <p> vs </p> <p> <a class="ext-link" href="https://github.com/boostorg/gil/blob/boost-1.68.0/include/boost/gil/gil_concept.hpp"><span class="icon">​</span>https://github.com/boostorg/gil/blob/boost-1.68.0/include/boost/gil/gil_concept.hpp</a> </p> <p> github ref: <a class="ext-link" href="https://github.com/boostorg/gil/projects/4#card-12439478"><span class="icon">​</span>https://github.com/boostorg/gil/projects/4#card-12439478</a> </p> Ticket