Boost logo

Boost :

Subject: [boost] [Smart Pointers] compilation error with ver 1.44 and VC 9
From: Evonik Energy Services GmbH (tobias.loew_at_[hidden])
Date: 2010-08-24 03:00:56


Hi,

after switching to version 1.44 my projects using make_shared won't compile anymore.
I'm using the VC 9 compiler on a Windows 2003 Server.
I'm confused that nobody else seems to have the same problem with make_shared, so here is a small example:

///////////////////////////////////////////////////////////////////////////////

#define BOOST_NO_TYPEID

#include <boost/smart_ptr.hpp>
#include <boost/make_shared.hpp>

struct test {
    test(){}
    int i;
};

int main(int argc, char* argv[])
{
    boost::shared_ptr<test> spt = boost::make_shared<test>();
    return 0;
}

/////////////////////////////////////////////////////////////////////////////////

this compiles fine with Boost 1.43, but with version 1.44 I get the following error:


boost/detail/sp_typeinfo.hpp(77) : error C2440: 'Initialisierung': 'const char *' kann nicht in
'boost::detail::sp_typeinfo' konvertiert werden
(in english: 'const char *' cannot be converted to 'boost::detail::sp_typeinfo')

In version 1.43 the line in sp_typeinfo.hpp(77) was:

template<class T> sp_typeinfo sp_typeid_≤ T >::ti_( sp_typeid_≤ T >::name() );

so, the explicit-marked ctor was called.
In version 1.44 it changed to

template<class T> sp_typeinfo sp_typeid_≤ T >::ti_ = sp_typeid_≤ T >::name();

and the explicit-marked ctor won't be called anymore.

The change message
(https://svn.boost.org/trac/boost/changeset/62245/trunk/boost/detail/sp_typeinfo.hpp)
refers to some fix for Sun C++.
IMO the change should better be guarded by some compiler/platform-detection macro.

Tobias


PS: I already posted this message on 18 Aug but accidentially as a reply to another thread.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk