Boost C++ Libraries: Ticket #4686: MSVC warning C4512 at /W4 (operator= can't be created) https://svn.boost.org/trac10/ticket/4686 <p> At /W4 msvc10 warns about not being able to generate the assignment operator for 4 classes. </p> <p> Example code that generates the warnings: </p> <pre class="wiki">#include &lt;boost/bimap.hpp&gt; int main(){ boost::bimap&lt; int, char &gt; bm; } </pre><p> As the boost warnings guidelines<a class="ext-link" href="https://svn.boost.org/trac/boost/wiki/Guidelines/WarningsGuidelines"><span class="icon">​</span>https://svn.boost.org/trac/boost/wiki/Guidelines/WarningsGuidelines</a> state "Adding the declaration (not the definition) of the appropriate operator=() as a private member does the trick as well." (disabling the warning by pragma would have to still be active at the point of bimap instantiation and thus disable the warning in user code) </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4686 Trac 1.4.3 Stefan van Kessel <van_kessel@…> Sun, 26 Sep 2010 20:19:10 GMT attachment set https://svn.boost.org/trac10/ticket/4686 https://svn.boost.org/trac10/ticket/4686 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">bimap_assignment_ops.patch</span> </li> </ul> <p> patch declaring operator= for classes for which it can't be generated </p> Ticket Stefan van Kessel <van_kessel@…> Sun, 26 Sep 2010 21:18:31 GMT <link>https://svn.boost.org/trac10/ticket/4686#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4686#comment:1</guid> <description> <p> There are template parameters for which the compiler can generate the operator= and for which just declaring it will therefore break some of the classes. A correct fix that works in all contexts is not as easy as I thought. A traits class like is_assignable for the member and base class types would be needed to only declare the operator= if either of the aforementioned is not assignable. </p> </description> <category>Ticket</category> </item> <item> <author>Stefan van Kessel <van_kessel@…></author> <pubDate>Sun, 26 Sep 2010 21:20:17 GMT</pubDate> <title>type changed https://svn.boost.org/trac10/ticket/4686#comment:2 https://svn.boost.org/trac10/ticket/4686#comment:2 <ul> <li><strong>type</strong> <span class="trac-field-old">Patches</span> → <span class="trac-field-new">Bugs</span> </li> </ul> Ticket Mateusz Loskot Wed, 06 Mar 2013 18:10:15 GMT cc set https://svn.boost.org/trac10/ticket/4686#comment:3 https://svn.boost.org/trac10/ticket/4686#comment:3 <ul> <li><strong>cc</strong> <span class="trac-author">mateusz@…</span> added </li> </ul> Ticket