Opened 10 years ago

Closed 10 years ago

#8027 closed Bugs (fixed)

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

Change History (8)

comment:1 by viboes, 10 years ago

Owner: changed from Anthony Williams to viboes
Status: newassigned

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 by James Perry <jperry@…>, 10 years ago

If I comment out those lines, it successfully compiles!

Thanks

comment:3 by viboes, 10 years ago

Milestone: To Be Determined
Resolution: wontfix
Status: assignedclosed

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

in reply to:  3 comment:4 by Manfred <kuhnkies@…>, 10 years ago

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 by viboes, 10 years ago

Resolution: wontfix
Status: closedreopened

comment:6 by viboes, 10 years ago

I will fix it soon.

comment:7 by viboes, 10 years ago

Milestone: Boost 1.54.0

Committed in trunk [83521].

comment:8 by viboes, 10 years ago

Resolution: fixed
Status: reopenedclosed

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

Note: See TracTickets for help on using tickets.