|
Boost Users : |
Subject: Re: [Boost-users] C++03 unique_ptr emulation
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2009-03-06 09:42:54
Would probably specifying the /Zm2000 compiler help?
Can't test it right now. This is the precompiled header memory size, but I
found it to be helpful even in non-precompiled header projects/files.
With Kind Regards,
Ovanes
On Fri, Mar 6, 2009 at 3:30 PM, Sergey Skorokhodov <ucayalyfish_at_[hidden]>wrote:
> Hi,
>
> Howard Hinnant wrote:
>
>> I've put up a new version of an C++03 emulated unique_ptr here:
>>
>
> <skip>
>
> I tried to use this implementation with MSVC 7.1 sp1 and 9.0 sp1 and
> encounter ICE in the following code:
>
> <code>
>
> #include <cstdlib>
> #include <string>
> #include "unique_ptr.hpp"
>
>
> class Base
> {
> protected:
> 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() {}
>
> private:
> boost::unique_ptr<char[]> target;
> };
>
> class Derived : public Base
> {
> public:
> 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;
> }
>
> </code>
>
> 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
> "file://c:\prj\VS2005\Projects\unique_tsts\unique_tst\Debug\BuildLog.htm"
> 1>unique_tst - 1 error(s), 0 warning(s)
>
> Is something wrong with my code or is it a "pure" MSVC bug?
>
> TIA
>
> --
> Sergey Skorokhodov
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net