Modify

Ticket #8027 (closed Bugs: fixed)

Opened 14 months ago

Last modified 13 months ago

thread library fails to compile with Visual Studio 2003

Reported by: James Perry <jperry@…> Owned by: viboes
Milestone: Boost 1.54.0 Component: thread
Version: Boost 1.53.0 Severity: Problem
Keywords: Cc:

Description

The thread library fails to build with VS2003. I've tried both boost-1.53.0 and the trunk from SVN. Prior to this, I had successfully compiled boost-1.49.0, so it's something that changed after that. I know the compiler is ancient, but sadly I can't use a newer one.

I'm building it with the command: bjam toolset=msvc-7.1 variant=release thread

An example error log:

compile-c-c++ bin.v2\libs\thread\build\msvc-7.1\release\debug-store-database\debug-symbols-on\link-static\pch-off\threading-multi\win32\thread.obj thread.cpp boost\thread\future.hpp(354) : warning C4913: user defined binary operator ',' exists but no overload could convert all operands, default built-in binary operator ',' used boost\thread\future.hpp(1394) : error C2951: template declarations are only permitted at global or namespace scope

boost\thread\future.hpp(1469) : see reference to class template instantiation 'boost::unique_future<R>' being compiled

boost\thread\future.hpp(1400) : error C2955: 'boost::unique_future' : use of class template requires template argument list

boost\thread\future.hpp(1469) : see declaration of 'boost::unique_future'

boost\thread\future.hpp(1400) : error C2146: syntax error : missing ')' before identifier 'a_future' boost\thread\future.hpp(1400) : error C2146: syntax error : missing ';' before identifier 'a_future' boost\thread\future.hpp(1400) : error C2377: 'boost::unique_future<R>::future_ptr' : redefinition; typedef cannot be overloaded with any other symbol

boost\thread\future.hpp(1375) : see declaration of 'boost::unique_future<R>::future_ptr'

boost\thread\future.hpp(1400) : error C2059: syntax error : ')' boost\thread\future.hpp(1401) : error C2065: 'a_future' : undeclared identifier boost\thread\future.hpp(1402) : fatal error C1903: unable to recover from previous error(s); stopping compilation

Attachments

Change History

comment:1 Changed 14 months ago by viboes

  • Owner changed from anthonyw to viboes
  • Status changed from new to assigned

It seems that the compiler doesn't like

        template <class Rp, class Fp>
        friend BOOST_THREAD_FUTURE<Rp>
        detail::make_future_async_object(BOOST_THREAD_FWD_REF(Fp) f);

        template <class Rp, class Fp>
        friend BOOST_THREAD_FUTURE<Rp>
        detail::make_future_deferred_object(BOOST_THREAD_FWD_REF(Fp) f);

I have no way to check it. Please could you try commenting these lines and make public all the needed members?

comment:2 Changed 14 months ago by James Perry <jperry@…>

If I comment out those lines, it successfully compiles!

Thanks

comment:3 follow-up: ↓ 4 Changed 14 months ago by viboes

  • Status changed from assigned to closed
  • Resolution set to wontfix
  • Milestone To Be Determined deleted

Gald to see that this work for you. I will no make any change on the repository.

comment:4 in reply to: ↑ 3 Changed 14 months ago by Manfred <kuhnkies@…>

Replying to viboes:

Gald to see that this work for you. I will no make any change on the repository.

Hello,

I'm not sure whether I understood the meaning of this posting, regarding changes for the next release of boost. I really would appreciate the code being fixed for MSVC .NET 2003 in the next release of boost. Thanks to this ticket here we were able to reproduce the fix and to build boost thread on MSVC2003 at all. I.e. we have a conditional compilation flag around the lines L1390-L1396 above.

before L1390: (file boost/thread/future.hpp, release 1_53_0)

#if (!defined _MSC_VER || _MSC_VER >= 1400) // _MSC_VER == 1400 on MSVC 2005

after L1396:

#endif // #if (!defined _MSC_VER || _MSC_VER >= 1400)

This should activate the code for compilers that don't define _MSC_VER (i.e. non-Microsoft compilers) and also for Microsoft compilers from MSVC 2005 and newer; MSVC 2003 then disregards the lines it does not understand syntactically. With this modification, thread.lib was built successfully on MSVC 2003, 2008, 2010, 2012, MinGW GCC 4.7.2 on x86 and x64. I didn't test MSVC 2005 (don't have it any longer) and I was too lazy to test with a MinGW GCC 4.8.0 preview. I don't know if there are any side effects if that functions are not declared as friends (MSVC 2003 only), but until now there didn't occur any problems in our application.

Best regards

Manfred

comment:5 Changed 13 months ago by viboes

  • Status changed from closed to reopened
  • Resolution wontfix deleted

comment:6 Changed 13 months ago by viboes

I will fix it soon.

comment:7 Changed 13 months ago by viboes

  • Milestone set to Boost 1.54.0

Committed in trunk [83521].

comment:8 Changed 13 months ago by viboes

  • Status changed from reopened to closed
  • Resolution set to fixed

(In [83660]) Thread: merge from trunk 1.54. Fix #8027,#8323,#8337.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.