
Hi all. One of our projects failed to build using the Boost 1.35 release and we traced it down to a compiler bug with MSVC 7.1. & 8.0. We have not tested any earlier compiler versions and MSVB 9.0 seems to have fixed the bug (and seems to compile the project in about half the time it took in MSVC 8.0 :-)))). We found a fix that should be applied to boost/pool/detail/mutex.hpp: The CRITICAL_SECTION type should be referenced using its fully qualified name '::CRITICAL_SECTION'. I am attaching a suggested patch file for boost/pool/detail/mutex.hpp. If no problems are found with it should be applied to the trunkas well as the release branch for the upcoming 1.35.1 patch release. The patch uses fully qualified names for other global Windows/posix API calls as well (e.g ::InitializeCriticalSection(), ::DeleteCriticalSection(), ::EnterCriticalSection(), ::LeaveCriticalSection()) but that does not have direct impact on this concrete bug. The following source file demonstrates the bug using boost libraries: #include "boost/archive/text_iarchive.hpp" #include "boost/pool/pool_alloc.hpp" int main() {} It should fail to build with an error message similar to: X:\Resources\Libraries\Boost\boost_1_35_0\boost\pool\detail\mutex.hpp(67) : error C2872: 'CRITICAL_SECTION' : ambiguous symbol could be 'X:\Resources\Libraries\PlatformSDK\Version_6.0\Include\WinBase.h(314) : RTL_CRITICAL_SECTION CRITICAL_SECTION' or 'X:\Resources\Libraries\Boost\boost_1_35_0\boost\detail\lwm_win32_cs.hpp(33) : boost::detail::CRITICAL_SECTION' Perhaps someone knows how and where to add the above example as a part of some regression test suite on MSVC 7.1 & 8.0? Here is also a minimal example demonstrating the same compiler bug without using any external libraries: namespace One { class Brick; } namespace Two { using namespace One; template <class TinyTemplateParam> class TinyClass {}; } class Brick {}; Brick brick; int main() {} Hope this helps. Best regards, Jurko Gospodnetić Index: pool/detail/mutex.hpp =================================================================== --- pool/detail/mutex.hpp (revision 44110) +++ pool/detail/mutex.hpp (working copy) @@ -64,23 +64,23 @@ class win32_mutex { private: - CRITICAL_SECTION mtx; + ::CRITICAL_SECTION mtx; win32_mutex(const win32_mutex &); void operator=(const win32_mutex &); public: win32_mutex() - { InitializeCriticalSection(&mtx); } + { ::InitializeCriticalSection(&mtx); } ~win32_mutex() - { DeleteCriticalSection(&mtx); } + { ::DeleteCriticalSection(&mtx); } void lock() - { EnterCriticalSection(&mtx); } + { ::EnterCriticalSection(&mtx); } void unlock() - { LeaveCriticalSection(&mtx); } + { ::LeaveCriticalSection(&mtx); } }; #endif // defined(BOOST_WINDOWS) @@ -90,23 +90,23 @@ class pthread_mutex { private: - pthread_mutex_t mtx; + ::pthread_mutex_t mtx; pthread_mutex(const pthread_mutex &); void operator=(const pthread_mutex &); public: pthread_mutex() - { pthread_mutex_init(&mtx, 0); } + { ::pthread_mutex_init(&mtx, 0); } ~pthread_mutex() - { pthread_mutex_destroy(&mtx); } + { ::pthread_mutex_destroy(&mtx); } void lock() - { pthread_mutex_lock(&mtx); } + { ::pthread_mutex_lock(&mtx); } void unlock() - { pthread_mutex_unlock(&mtx); } + { ::pthread_mutex_unlock(&mtx); } }; #endif // defined(_POSIX_THREADS) || defined(BOOST_HAS_PTHREADS)