Boost C++ Libraries: Ticket #2270: Compile Warning: Assignment Operator Could not be generated https://svn.boost.org/trac10/ticket/2270 <p> Visual Studio 2005 warning <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4512" title="#4512: Bugs: [program_options]: wrong option_description returned by ... (closed: fixed)">#4512</a>: "assignment operator could not be generated" is spawned during compile when including array.hpp and extended_type_info.hpp. </p> <p> The attached patch declares a private assignment operator in the "array" and "extended_type_info" classes. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2270 Trac 1.4.3 Ryan Mulder <rjmyst3@…> Fri, 29 Aug 2008 15:20:29 GMT attachment set https://svn.boost.org/trac10/ticket/2270 https://svn.boost.org/trac10/ticket/2270 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">assignment_operator_warning.patch</span> </li> </ul> Ticket Robert Ramey Wed, 24 Sep 2008 20:02:33 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/2270#comment:1 https://svn.boost.org/trac10/ticket/2270#comment:1 <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">wontfix</span> </li> </ul> <p> Instances of neither one of these classes should be assigned or copy constructed. An attempt to do so would be a serious error. As things are now, any attempt to assign or copy an instance of either of these classes would result in a compile-time error- which is what we want. Including this "fix" would permit the compilation to succeed and produce a program which would fail in subtle ways. </p> <p> Robert Ramey </p> Ticket Ryan Mulder <rjmyst3@…> Wed, 21 Jan 2009 15:15:48 GMT status, version, milestone changed; resolution deleted https://svn.boost.org/trac10/ticket/2270#comment:2 https://svn.boost.org/trac10/ticket/2270#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost 1.36.0</span> → <span class="trac-field-new">Boost 1.37.0</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">wontfix</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.37.0</span> → <span class="trac-field-new">To Be Determined</span> </li> </ul> <p> Robert, </p> <blockquote> <p> Thanks for looking at this. I didn't reply to your comment 4 months ago, because I assumed you'd silence the warning in a different manner. </p> </blockquote> <blockquote> <p> As the warning from extended_type_info.hpp is still spawned during compilation, I urge you to reconsider this patch. </p> </blockquote> <blockquote> <p> I understand the design intent is to not allow copying the class. If you look closely at the patch, you'll see that the assignment operator is only declared, not defined. It is also in the private scope of the class. </p> </blockquote> <blockquote> <p> This will make your intent to prevent copying clear both to the compiler and the programmer, while still producing a compile-time error on an attempt to assign an instance of the class. </p> </blockquote> <p> Ryan Mulder </p> Ticket Robert Ramey Sun, 25 Jan 2009 18:26:09 GMT <link>https://svn.boost.org/trac10/ticket/2270#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2270#comment:3</guid> <description> <p> OK, I've updated extended_type_info to make it non-copyable. </p> <p> But review array.hpp. I contains make_array which returns a copy of an array wrapper and make_array is in fact used by the system and tests. That is, array must be copyable. I can't explain why this generates a warning. Perhaps array should contain an explicit copy/assignment constructors but I don't see why that should be necessary. </p> <p> Take another look at array. </p> <p> Robert Ramey </p> </description> <category>Ticket</category> </item> <item> <author>Ryan Mulder <rjmyst3@…></author> <pubDate>Mon, 26 Jan 2009 13:10:37 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2270#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2270#comment:4</guid> <description> <p> Thank you for updating extended_type_info. </p> <p> I posted this patch against 1.36; as of 1.37, I do not see warnings from array. I think this issue is resolved. </p> <p> Thanks very much for you help. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Sat, 31 Jan 2009 18:18:03 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/2270#comment:5 https://svn.boost.org/trac10/ticket/2270#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket