Boost logo

Boost Users :

Subject: Re: [Boost-users] C++03 unique_ptr emulation
From: Sergey Skorokhodov (ucayalyfish_at_[hidden])
Date: 2009-03-06 09:30:23


Howard Hinnant wrote:
> I've put up a new version of an C++03 emulated unique_ptr here:


I tried to use this implementation with MSVC 7.1 sp1 and 9.0 sp1 and
encounter ICE in the following code:


#include <cstdlib>
#include <string>
#include "unique_ptr.hpp"

class Base
     explicit Base( std::string const & src )
         target.reset( new char[src.length() + 1] );
         memcpy( target.get(), src.c_str(), src.length() );
         target[src.length()] = '0';

     explicit Base( boost::unique_ptr<char[]> src )
     : target( move(src) )
     virtual ~Base() {}

     boost::unique_ptr<char[]> target;

class Derived : public Base
     explicit Derived( std::string const & src ) : Base( src ) {}
     explicit Derived( boost::unique_ptr<char[]> src )
         : Base( move( src ) ) {}
     virtual ~Derived() {}

int main(int argc, char * argv[])
     char const TEXT[] = "This is a text";
     boost::unique_ptr<char[]> ptxt( new char[sizeof(TEXT)] );
     Derived drv( move( ptxt ) );
     return 0;


Here is the exact compiler output:

1>c:\prj\vs2005\projects\unique_tsts\unique_tst\unique_tst.cpp(21) :
fatal error C1001: An internal error has occurred in the compiler.
1>(compiler file 'f:\dd\vctools\compiler\utc\src\p2\ehexcept.c', line 1454)
1> To work around this problem, try simplifying or changing the program
near the locations listed above.
1>Please choose the Technical Support command on the Visual C++
1> Help menu, or open the Technical Support help file for more information
1>Build log was saved at
1>unique_tst - 1 error(s), 0 warning(s)

Is something wrong with my code or is it a "pure" MSVC bug?


Sergey Skorokhodov

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at