Boost C++ Libraries: Ticket #5538: boost.mpi miscompiles with gcc4.6 and option -std=c++0x https://svn.boost.org/trac10/ticket/5538 <p> Hello </p> <p> boost.mpi with gcc-4.6 and the option -std=c++0x don't get well together here is a very simple example </p> <hr /> <p> #include &lt;boost/mpi.hpp&gt; </p> <hr /> <blockquote> <p> the issue arises with the use of the -std=c++0x flag to use </p> </blockquote> <p> the new c++ standard. It use to work properly with previous g++ version </p> <p> compile without -std=c++0x g++ -I/usr/include/mpi -c t.cpp no errors </p> <p> try compiling with -std=c++0x </p> <blockquote> <p> g++ -I/usr/include/mpi -std=c++0x -c t.cpp </p> </blockquote> <blockquote> <blockquote> <p> 2011-05-12 22:40:17 </p> </blockquote> </blockquote> <p> prudhomm pts/28 In file included from /usr/include/c++/4.6/memory:67:0, </p> <blockquote> <p> from /usr/include/boost/mpi/allocator.hpp:18, from /usr/include/boost/mpi.hpp:22, from t.cpp:3: </p> </blockquote> <p> /usr/include/c++/4.6/bits/stl_uninitialized.h: In function ‘void std::<span class="underline">uninitialized_default_n_a(_ForwardIterator, _Size, _Allocator&amp;) [with _ForwardIterator = char*, _Size = long unsigned int, _Allocator </span></p> <h1 class="section" id="boost::mpi::allocatorchar:">boost::mpi::allocator&lt;char&gt;]’:</h1> <p> /usr/include/c++/4.6/bits/vector.tcc:474:8: instantiated from ‘void std::vector&lt;_Tp, _Alloc&gt;::_M_default_append(std::vector&lt;_Tp, _Alloc&gt;::size_type) [with _Tp = char, _Alloc = boost::mpi::allocator&lt;char&gt;, std::vector&lt;_Tp, _Alloc&gt;::size_type = long unsigned int]’ /usr/include/c++/4.6/bits/stl_vector.h:592:4: instantiated from ‘void std::vector&lt;_Tp, _Alloc&gt;::resize(std::vector&lt;_Tp, _Alloc&gt;::size_type) [with _Tp = char, _Alloc = boost::mpi::allocator&lt;char&gt;, std::vector&lt;_Tp, _Alloc&gt;::size_type = long unsigned int]’ /usr/include/boost/mpi/detail/packed_oprimitive.hpp:96:46: instantiated from here /usr/include/c++/4.6/bits/stl_uninitialized.h:576:6: error: no matching function for call to ‘boost::mpi::allocator&lt;char&gt;::construct(char*)’ /usr/include/c++/4.6/bits/stl_uninitialized.h:576:6: note: candidate is: /usr/include/boost/mpi/allocator.hpp:168:8: note: void boost::mpi::allocator&lt;T&gt;::construct(boost::mpi::allocator&lt;T&gt;::pointer, const T&amp;) [with T = char, boost::mpi::allocator&lt;T&gt;::pointer = char*] /usr/include/boost/mpi/allocator.hpp:168:8: note: candidate expects 2 arguments, 1 provided </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5538 Trac 1.4.3 Thomas Taylor <thomas.taylor@…> Sat, 21 May 2011 10:15:36 GMT cc changed https://svn.boost.org/trac10/ticket/5538#comment:1 https://svn.boost.org/trac10/ticket/5538#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">thomas.taylor@…</span> added </li> </ul> Ticket petar.marendic@… Mon, 17 Oct 2011 13:29:37 GMT <link>https://svn.boost.org/trac10/ticket/5538#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5538#comment:2</guid> <description> <p> My fix for this was to define a corresponding member function of the class <strong>allocator</strong> in <em>boost/mpi/allocator.h</em>: </p> <blockquote> <p> /* Default construct a value of type T at the location referenced by p. */ </p> <blockquote> <p> void construct(pointer p) { </p> <blockquote> <p> new ((void *)p) T(); </p> </blockquote> <p> } </p> </blockquote> </blockquote> </description> <category>Ticket</category> </item> <item> <author>jwakely.boost@…</author> <pubDate>Mon, 19 Dec 2011 10:41:02 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5538#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5538#comment:3</guid> <description> <p> This is a GCC 4.6 bug that only affects -std=c++0x mode. </p> <p> In C++0x mode we assume all allocators provide the C++11 allocator interface, which is a bad assumption. The fix (which I've implemented in GCC 4.7) is to use std::allocator_traits to support allocators without the full interface. </p> <p> I'm going to open a GCC bug and will update this ticket with a link. </p> <p> A workaround is to provide construct(pointer) in the MPI allocator, or even to provide the C++11-style: </p> <blockquote> <p> template&lt;typename... Args&gt; void construct(T*, Args&amp;&amp;...); </p> </blockquote> </description> <category>Ticket</category> </item> <item> <author>jwakely.boost@…</author> <pubDate>Mon, 19 Dec 2011 18:05:15 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5538#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5538#comment:4</guid> <description> <p> <a class="ext-link" href="http://gcc.gnu.org/PR51626"><span class="icon">​</span>http://gcc.gnu.org/PR51626</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Mateusz Loskot</dc:creator> <pubDate>Mon, 19 Dec 2011 18:13:00 GMT</pubDate> <title>cc changed https://svn.boost.org/trac10/ticket/5538#comment:5 https://svn.boost.org/trac10/ticket/5538#comment:5 <ul> <li><strong>cc</strong> <span class="trac-author">mateusz@…</span> added </li> </ul> Ticket Mateusz Loskot Thu, 22 Dec 2011 10:34:37 GMT <link>https://svn.boost.org/trac10/ticket/5538#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5538#comment:6</guid> <description> <p> Jonathan has fixed the GCC <a class="ext-link" href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51626"><span class="icon">​</span>Bug 51626</a> linked above. The fix will be in GCC 4.6.3 </p> </description> <category>Ticket</category> </item> <item> <author>smr@…</author> <pubDate>Wed, 01 Feb 2012 04:06:32 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5538#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5538#comment:7</guid> <description> <p> Can this be applied for release 1.49, please? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Matthias Troyer</dc:creator> <pubDate>Tue, 01 Jan 2013 11:43:46 GMT</pubDate> <title>owner changed https://svn.boost.org/trac10/ticket/5538#comment:8 https://svn.boost.org/trac10/ticket/5538#comment:8 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Douglas Gregor</span> to <span class="trac-author">Matthias Troyer</span> </li> </ul> Ticket