Boost, MSVC .Net 2003 and internal compiler crash

Sometimes, you have to manage recent code (Boost 1.4.2) with old compiler (MSVC .NET 2003). And the biggest nightmare is such a message in the compilation log:

boost\smart_ptr\intrusive_ptr.hpp(80) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 2708)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information

What to do?

Here is my (strange) fix: You re handling intrusive_ptr on objects of class X. You should specialize thee intrusive_ptr template with such code:

template<class U>
boost::intrusive_ptr<X>::intrusive_ptr( intrusive_ptr<U> const & rhs, typename detail::sp_enable_if_convertible<U, X>::type )
: px( rhs.get() )
if( px != 0 )
intrusive_ptr_add_ref( px );

I don t know exactly why it s working... but I don t care :) The main difficulty is to find the X classes which make the compiler crash. Good luck!

Disclaimer: it is possible that your problem can be caused (and solved) by something totally different!

Ajouter un commentaire

Le code HTML est affiché comme du texte et les adresses web sont automatiquement transformées.

Add ping

URL de rétrolien :

Haut de page