Boost C++ Libraries: Ticket #7876: container::map fails with unions https://svn.boost.org/trac10/ticket/7876 <p> Hello, </p> <p> At least in boost 1.52.0 there seems to be a problem with container::map and the use of unions (and I suppose the problem might exist with similar types like container::set, etc., though I haven't tested it). Try this code snippet to reproduce: </p> <pre class="wiki">#include &lt;map&gt; #include &lt;boost/container/map.hpp&gt; union TU {}; void boostMapFail(void) { std::map &lt;unsigned int, TU&gt; stdTest; boost::container::map&lt;unsigned int, TU&gt; boostTest; TU u; stdTest[5U] = u; // Does compile :-) boostTest[5U] = u; // Fails miserably :-( } </pre><p> This fails under and MSVC2005 and GCC 4.3: </p> <p> MSVC2005: boost/move/move.hpp(254) : error C2569: 'TU' : enum/union cannot be used as a base class </p> <p> GCC 4.3: boost/move/move.hpp:254: error: base type 'TU' fails to be a struct or class type </p> <p> On the contrary, using std::map instead of boost::container::map *does* compile without a hitch, so I would expect boost to behave identically. </p> <p> Best regards </p> <p> Peter </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7876 Trac 1.4.3 Robert Matusewicz <matekm@…> Sat, 30 Aug 2014 15:26:27 GMT cc set https://svn.boost.org/trac10/ticket/7876#comment:1 https://svn.boost.org/trac10/ticket/7876#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">matekm@…</span> added </li> </ul> <p> Hi, </p> <p> This problem was fixed as in master and develop branch code provided in this ticket description compiles without an error. </p> Ticket viboes Sun, 06 Dec 2015 08:52:20 GMT <link>https://svn.boost.org/trac10/ticket/7876#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7876#comment:2</guid> <description> <p> If this has already been fixed, maybe we can close the ticket. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Thu, 24 Dec 2015 00:29:52 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/7876#comment:3 https://svn.boost.org/trac10/ticket/7876#comment:3 <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> </ul> <p> Fixed as no further error was reported. </p> Ticket