Modify

Opened 5 years ago

#8689 new Bugs

Solaris: make_shared<const T> compile error

Reported by: matthew.bergin@… Owned by: Peter Dimov
Milestone: To Be Determined Component: smart_ptr
Version: Boost 1.51.0 Severity: Problem
Keywords: make_shared Cc:

Description

Compile this with Forte 11 (Sun C++ 5.8 Patch 121017-08 2006/12/06):

#include <boost/make_shared.hpp>
struct Foo { virtual ~Foo() {} };
void f() { boost::make_shared<const Foo>(); }

Compiler error is:

"/usr/local/include/boost/smart_ptr/make_shared.hpp", line 60: Error: Non-const function Foo::__SLIP.DELETER__C() called for const object.
"/usr/local/include/boost/smart_ptr/make_shared.hpp", line 86:     Where: While instantiating "boost::detail::sp_ms_deleter<const Foo>::destroy()".
"/usr/local/include/boost/smart_ptr/make_shared.hpp", line 86:     Where: Instantiated from boost::make_shared<const Foo>().
"test.cpp", line 3:     Where: Instantiated from non-template code.

Further testing shows the compiler incorrectly refuses to compile an explicit destructor call on any const T* with a virtual destructor.

Would it be worth explicitly removing const from sp_ms_deleter's template parameter?

Attachments (1)

make_shared_const.patch (573 bytes) - added by matthew.bergin@… 5 years ago.

Download all attachments as: .zip

Change History (1)

Changed 5 years ago by matthew.bergin@…

Attachment: make_shared_const.patch added

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Peter Dimov.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.