Opened 12 years ago
Closed 10 years ago
#5040 closed Bugs (fixed)
future.hpp in boost::thread does not compile with /clr
Reported by: | Owned by: | viboes | |
---|---|---|---|
Milestone: | Boost 1.52.0 | Component: | thread |
Version: | Boost 1.45.0 | Severity: | Problem |
Keywords: | MANAGED | Cc: | viboes |
Description
Including thread.hpp in a project using the /clr compiler flag results in the following output.
[...]\boost-1.45\include\boost-1_45\boost/thread/future.hpp(422) : error C2666: 'boost::scoped_array<T>: :operator []' : 2 overloads have similar conversions with [ T=boost::unique_lock<boost::mutex> ] [...]\boost-1.45\include\boost-1_45\boost/smart_ptr/scoped_array.hpp(77): could be 'boost::uniqu e_lock<Mutex> &boost::scoped_array<T>::operator [](ptrdiff_t) const' with [ Mutex=boost::mutex, T=boost::unique_lock<boost::mutex> ] or 'built-in C++ operator[(void (__cdecl *)(boost::scoped_array<T> ***), boost::detail::future_waiter::count_typ e)' with [ T=boost::unique_lock<boost::mutex> ] while trying to match the argument list '(boost::scoped_array<T>, boost::detail::future_waiter::count_type)' with [ T=boost::unique_lock<boost::mutex> ] [...]\boost-1.45\include\boost-1_45\boost/thread/future.hpp(435) : error C2666: 'boost::scoped_array<T>: :operator []' : 2 overloads have similar conversions with [ T=boost::unique_lock<boost::mutex> ] [...]\boost-1.45\include\boost-1_45\boost/smart_ptr/scoped_array.hpp(77): could be 'boost::uniqu e_lock<Mutex> &boost::scoped_array<T>::operator [](ptrdiff_t) const' with [ Mutex=boost::mutex, T=boost::unique_lock<boost::mutex> ] or 'built-in C++ operator[(void (__cdecl *)(boost::scoped_array<T> ***), boost::detail::future_waiter::count_typ e)' with [ T=boost::unique_lock<boost::mutex> ] while trying to match the argument list '(boost::scoped_array<T>, boost::detail::future_waiter::count_type)' with [ T=boost::unique_lock<boost::mutex> ] [...]\boost-1.45\include\boost-1_45\boost/thread/future.hpp(435) : error C2228: left of '.unlock' must h ave class/struct/union
I couldn't find any tickets on this problem however a quick google brought up someone who has encountered this before: http://groups.google.com/group/boost-list/browse_thread/thread/9662c882efc153b6?pli=1
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?
Attachments (1)
Change History (14)
follow-up: 3 comment:1 by , 11 years ago
Cc: | added |
---|
comment:2 by , 11 years ago
typedef std::vector<registered_waiter>::size_type count_type;
takes me to this definition:
typedef typename _Alloc::size_type size_type;
However I'm not sure how much further I can dig there.
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.
I can then compile but get the following warning which causes an error at runtime:
warning LNK4248: unresolved typeref token (0100001E) for 'boost.detail.win32._SECURITY_ATTRIBUTES'; image may not run
However I imagine this is a separate issue and therefore not relevant to this ticket.
comment:3 by , 11 years ago
Apologies I appear to have missed the Reply button initially. Please see the comment below for my response.
Replying to viboes:
Currently the type is defined as
typedef std::vector<registered_waiter>::size_type count_type;
Please could you verify which types is this on your platform?
Could you try changing
for(count_type i=0;i<count;++i)
by
for(std::ptrdiff_t i=0;i<count;++i)
to see if the patch solve the issue?
comment:4 by , 11 years ago
Cc: | removed |
---|---|
Owner: | changed from | to
Status: | new → assigned |
by , 11 years ago
Attachment: | 5040.patch added |
---|
comment:6 by , 11 years ago
Cc: | added |
---|---|
Keywords: | MANAGED added |
Milestone: | To Be Determined → Boost 1.49.0 |
Committed in trunk #75901
comment:7 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:8 by , 10 years ago
This patch was overwritten again in trunk (and versions 1.49, 1.50) by svn change #76543. Please reapply it.
comment:9 by , 10 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
I reopen it due to last comment and encountered bug.
comment:11 by , 10 years ago
Milestone: | Boost 1.49.0 → Boost 1.52.0 |
---|
Sorry for the disturbance. I will apply it today.
comment:13 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Committed revision [81035].
Currently the type is defined as
Please could you verify which types is this on your platform?
Could you try changing
by
to see if the patch solve the issue?