Opened 12 years ago

Closed 12 years ago

#4199 closed Patches (fixed)

Sun Studio compilation of sp_typeinfo.hpp

Reported by: nstewart@… Owned by: Peter Dimov
Milestone: Boost 1.44.0 Component: smart_ptr
Version: Boost Development Trunk Severity: Showstopper
Keywords: SunPro, sp_typeinfo, Sun Studio Cc:

Description

The Sun Studio compiler gets confused about static initialization constructor arguments. But an assignment works just fine.

Observed in boost 1.42.0, same code in trunk and 1.43.0.

Using flags: BOOST_CXXFLAGS += -DBOOST_NO_IOSTREAM=1 BOOST_CXXFLAGS += -DBOOST_NO_TYPEID=1 BOOST_CXXFLAGS += -DBOOST_NO_RTTI=1 BOOST_CXXFLAGS += -DBOOST_SP_DISABLE_THREADS=1 BOOST_CXXFLAGS += -DBOOST_NO_EXCEPTIONS=1 BOOST_CXXFLAGS += -DBOOST_PTR_CONTAINER_NO_EXCEPTIONS=1 BOOST_CXXFLAGS += -DBOOST_REGEX_NO_LIB=1 BOOST_CXXFLAGS += -DBOOST_REGEX_NO_W32=1 BOOST_CXXFLAGS += -DBOOST_REGEX_NON_RECURSIVE=1 BOOST_CXXFLAGS += -DBOOST_REGEX_NO_EXTERNAL_TEMPLATES=1 BOOST_CXXFLAGS += -DBOOST_NO_WREGEX=1 BOOST_CXXFLAGS += -DBOOST_ALL_NO_LIB=1

Attachments (1)

boost_detail_typeinfo_SunPro.diff (440 bytes ) - added by nstewart@… 12 years ago.
Patch for boost/detail/sp_typeinfo.hpp

Download all attachments as: .zip

Change History (8)

by nstewart@…, 12 years ago

Patch for boost/detail/sp_typeinfo.hpp

comment:1 by Steven Watanabe, 12 years ago

Component: Nonesmart_ptr
Owner: set to Peter Dimov

comment:2 by Peter Dimov, 12 years ago

(In [62245]) Applied patch for Sun C++. Refs #4199.

comment:3 by Peter Dimov, 12 years ago

Resolution: fixed
Status: newclosed

(In [63825]) Merge [62245] to release. Fixes #4199.

comment:4 by Tobias Loew, 12 years ago

Resolution: fixed
Status: closedreopened

After the change the following code doesn't compile anymore on my VC 9 compiler:

#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;
}

the error message is: 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')

Before the change 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. Afterwards it changed to

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

so the with "explicit" marked ctor of sp_typeid< T > can't be called anymore.

I suggest protecting the change with some compiler/platform-detection macro for the Sun Studio

Tobias

comment:5 by nstewart@…, 12 years ago

The appropriate check for the SunPro compiler would be: SUNPRO_CC But I suspect that SunPro is right, and MSVC is wrong. :-)

  • Nigel

comment:6 by nstewart@…, 12 years ago

Oops, make that

__SUNPRO_CC

comment:7 by Peter Dimov, 12 years ago

Resolution: fixed
Status: reopenedclosed

This was fixed with [66031], [66091], [66166].

Note: See TracTickets for help on using tickets.