Boost C++ Libraries: Ticket #5040: future.hpp in boost::thread does not compile with /clr https://svn.boost.org/trac10/ticket/5040 <p> Including thread.hpp in a project using the /clr compiler flag results in the following output. </p> <pre class="wiki"> [...]\boost-1.45\include\boost-1_45\boost/thread/future.hpp(422) : error C2666: 'boost::scoped_array&lt;T&gt;: :operator []' : 2 overloads have similar conversions with [ T=boost::unique_lock&lt;boost::mutex&gt; ] [...]\boost-1.45\include\boost-1_45\boost/smart_ptr/scoped_array.hpp(77): could be 'boost::uniqu e_lock&lt;Mutex&gt; &amp;boost::scoped_array&lt;T&gt;::operator [](ptrdiff_t) const' with [ Mutex=boost::mutex, T=boost::unique_lock&lt;boost::mutex&gt; ] or 'built-in C++ operator[(void (__cdecl *)(boost::scoped_array&lt;T&gt; ***), boost::detail::future_waiter::count_typ e)' with [ T=boost::unique_lock&lt;boost::mutex&gt; ] while trying to match the argument list '(boost::scoped_array&lt;T&gt;, boost::detail::future_waiter::count_type)' with [ T=boost::unique_lock&lt;boost::mutex&gt; ] [...]\boost-1.45\include\boost-1_45\boost/thread/future.hpp(435) : error C2666: 'boost::scoped_array&lt;T&gt;: :operator []' : 2 overloads have similar conversions with [ T=boost::unique_lock&lt;boost::mutex&gt; ] [...]\boost-1.45\include\boost-1_45\boost/smart_ptr/scoped_array.hpp(77): could be 'boost::uniqu e_lock&lt;Mutex&gt; &amp;boost::scoped_array&lt;T&gt;::operator [](ptrdiff_t) const' with [ Mutex=boost::mutex, T=boost::unique_lock&lt;boost::mutex&gt; ] or 'built-in C++ operator[(void (__cdecl *)(boost::scoped_array&lt;T&gt; ***), boost::detail::future_waiter::count_typ e)' with [ T=boost::unique_lock&lt;boost::mutex&gt; ] while trying to match the argument list '(boost::scoped_array&lt;T&gt;, boost::detail::future_waiter::count_type)' with [ T=boost::unique_lock&lt;boost::mutex&gt; ] [...]\boost-1.45\include\boost-1_45\boost/thread/future.hpp(435) : error C2228: left of '.unlock' must h ave class/struct/union </pre><p> I couldn't find any tickets on this problem however a quick google brought up someone who has encountered this before: <a class="ext-link" href="http://groups.google.com/group/boost-list/browse_thread/thread/9662c882efc153b6?pli=1"><span class="icon">​</span>http://groups.google.com/group/boost-list/browse_thread/thread/9662c882efc153b6?pli=1</a> </p> <p> unsigned should probably convert to ptrdiff_t implicitly but it's throwing a wobbly with /clr. Maybe this is fair enough as specifying /clr opens a whole new world of pain (I was just trying my luck really!), nevertheless would it be sensible to change the types from unsigned to ptrdiff_t as that's what operator[] requires? </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5040 Trac 1.4.3 viboes Wed, 11 May 2011 05:40:27 GMT cc set https://svn.boost.org/trac10/ticket/5040#comment:1 https://svn.boost.org/trac10/ticket/5040#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">viboes</span> added </li> </ul> <p> Currently the type is defined as </p> <blockquote> <p> typedef std::vector&lt;registered_waiter&gt;::size_type count_type; </p> </blockquote> <p> Please could you verify which types is this on your platform? </p> <p> Could you try changing </p> <blockquote> <p> for(count_type i=0;i&lt;count;++i) </p> </blockquote> <p> by </p> <blockquote> <p> for(std::ptrdiff_t i=0;i&lt;count;++i) </p> </blockquote> <p> to see if the patch solve the issue? </p> Ticket colin.powers@… Mon, 23 May 2011 11:45:26 GMT <link>https://svn.boost.org/trac10/ticket/5040#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5040#comment:2</guid> <description> <p> typedef std::vector&lt;registered_waiter&gt;::size_type count_type; </p> <p> takes me to this definition: </p> <p> typedef typename _Alloc::size_type size_type; </p> <p> However I'm not sure how much further I can dig there. </p> <p> Altering the for loops as you suggested on lines 420 and 433, along with altering the type of count on line 414 to be std::ptrdiff_t as well, gets rid of the errors. count had to change type to avoid signed/unsigned errors. </p> <p> I can then compile but get the following warning which causes an error at runtime: </p> <p> warning LNK4248: unresolved typeref token (0100001E) for 'boost.detail.win32._SECURITY_ATTRIBUTES'; image may not run </p> <p> However I imagine this is a separate issue and therefore not relevant to this ticket. </p> </description> <category>Ticket</category> </item> <item> <author>Colin Powers <colin.powers@…></author> <pubDate>Mon, 23 May 2011 12:05:55 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5040#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5040#comment:3</guid> <description> <p> Apologies I appear to have missed the Reply button initially. Please see the comment below for my response. </p> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/5040#comment:1" title="Comment 1">viboes</a>: </p> <blockquote class="citation"> <p> Currently the type is defined as </p> <blockquote> <p> typedef std::vector&lt;registered_waiter&gt;::size_type count_type; </p> </blockquote> <p> Please could you verify which types is this on your platform? </p> <p> Could you try changing </p> <blockquote> <p> for(count_type i=0;i&lt;count;++i) </p> </blockquote> <p> by </p> <blockquote> <p> for(std::ptrdiff_t i=0;i&lt;count;++i) </p> </blockquote> <p> to see if the patch solve the issue? </p> </blockquote> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 04 Dec 2011 00:25:42 GMT</pubDate> <title>owner, status changed; cc deleted https://svn.boost.org/trac10/ticket/5040#comment:4 https://svn.boost.org/trac10/ticket/5040#comment:4 <ul> <li><strong>cc</strong> <span class="trac-author">viboes</span> removed </li> <li><strong>owner</strong> changed from <span class="trac-author">Anthony Williams</span> to <span class="trac-author">viboes</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket viboes Sat, 10 Dec 2011 16:08:32 GMT attachment set https://svn.boost.org/trac10/ticket/5040 https://svn.boost.org/trac10/ticket/5040 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">5040.patch</span> </li> </ul> Ticket viboes Sat, 10 Dec 2011 16:09:45 GMT <link>https://svn.boost.org/trac10/ticket/5040#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5040#comment:5</guid> <description> <p> Could you check this patch? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 11 Dec 2011 13:36:15 GMT</pubDate> <title>milestone changed; cc, keywords set https://svn.boost.org/trac10/ticket/5040#comment:6 https://svn.boost.org/trac10/ticket/5040#comment:6 <ul> <li><strong>cc</strong> <span class="trac-author">viboes</span> added </li> <li><strong>keywords</strong> MANAGED added </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.49.0</span> </li> </ul> <p> Committed in trunk <a class="missing ticket">#75901</a> </p> Ticket viboes Sat, 07 Jan 2012 20:53:02 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/5040#comment:7 https://svn.boost.org/trac10/ticket/5040#comment:7 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/76346" title="Thread: merge from trunk to fix #6141, #5594, #5040 and #5502.">[76346]</a>) Thread: merge from trunk to fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6141" title="#6141: Bugs: Compilation error when boost.thread and boost.move are used together (closed: fixed)">#6141</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5594" title="#5594: Bugs: boost::shared_mutex not fully compatible with Windows CE. (closed: fixed)">#5594</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5040" title="#5040: Bugs: future.hpp in boost::thread does not compile with /clr (closed: fixed)">#5040</a> and <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5502" title="#5502: Patches: race condition between shared_mutex timed_lock and lock_shared (closed: fixed)">#5502</a>. </p> Ticket anonymous Fri, 20 Jul 2012 08:57:11 GMT <link>https://svn.boost.org/trac10/ticket/5040#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5040#comment:8</guid> <description> <p> This patch was overwritten again in trunk (and versions 1.49, 1.50) by svn change <a class="missing ticket">#76543</a>. Please reapply it. </p> </description> <category>Ticket</category> </item> <item> <author>moala@…</author> <pubDate>Fri, 19 Oct 2012 13:42:39 GMT</pubDate> <title>status changed; resolution deleted https://svn.boost.org/trac10/ticket/5040#comment:9 https://svn.boost.org/trac10/ticket/5040#comment:9 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> I reopen it due to last comment and encountered bug. </p> Ticket moala@… Fri, 19 Oct 2012 13:43:36 GMT <link>https://svn.boost.org/trac10/ticket/5040#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5040#comment:10</guid> <description> <p> (still buggy in 1.51.0) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sat, 20 Oct 2012 09:43:23 GMT</pubDate> <title>milestone changed https://svn.boost.org/trac10/ticket/5040#comment:11 https://svn.boost.org/trac10/ticket/5040#comment:11 <ul> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.49.0</span> → <span class="trac-field-new">Boost 1.52.0</span> </li> </ul> <p> Sorry for the disturbance. I will apply it today. </p> Ticket viboes Sun, 21 Oct 2012 09:28:12 GMT <link>https://svn.boost.org/trac10/ticket/5040#comment:12 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5040#comment:12</guid> <description> <p> Committed in trunk revision <a class="changeset" href="https://svn.boost.org/trac10/changeset/81032" title="Thread: merge 81024">[81032]</a><a class="changeset" href="https://svn.boost.org/trac10/changeset/81034" title="Thread: remove include iostream">[81034]</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 21 Oct 2012 11:57:36 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/5040#comment:13 https://svn.boost.org/trac10/ticket/5040#comment:13 <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> <p> Committed revision <a class="changeset" href="https://svn.boost.org/trac10/changeset/81035" title="Thread: merge [81032][81034]">[81035]</a>. </p> Ticket