Boost logo

Boost Users :

Subject: Re: [Boost-users] Error:" Non-const function called for const object" on Sun CC while using boost::multi_index::multi_index_container
From: Alexander Vinokur (Alexander.Vinokur_at_[hidden])
Date: 2008-10-12 02:44:02


Hi Joaquín,

I was out of office several days. Sorry.
So, I send my reply today.

I don't have permissions to change something under /boost.

But here other test I did:

--- file foo19.cpp ---
struct Bar
{
    virtual ~Bar(){}
};

int main()
{
        
        const Bar* p1 = new Bar;
        const_cast<Bar*>(p1)->~Bar(); // No problem
        
        const Bar* p2 = new Bar;
        p2->~Bar(); // line 13: Error: Non-const function Bar::__SLIP.DELETER__A() called for const object.
        
        return 0;
}
-------------------

Compilation:
%CC -m64 -library=stlport4 foo19.cpp

====================================================
"JOAQUIN M. LOPEZ MU?OZ" <joaquin_at_[hidden]> wrote in message news:<D1B8B06869125E44A4B33FF31CBAEA591187ADF179_at_EXCLU2K7.hi.inet>...
De: Alexander Vinokur [Alexander.Vinokur_at_[hidden]]
Enviado el: martes, 07 de octubre de 2008 18:28
Para: boost-users_at_[hidden]
CC: JOAQUIN M. LOPEZ MU?OZ
Asunto: RE: Error:" Non-const function called for const object" on Sun CC w=ile using boost::multi_index::multi_index_container
>
> Joaquin, thank you.
>
> Here code I compiled.
>
> // --- File foo3.cpp ---
> [...]
> const Bar* p4 = new Bar;
> p4->~Bar(); // line 19: Error: Non-const function
> Bar::__SLIP.DELETER__A() called for const object.

OK, seems like the bug we were after, if only in a slightly different guise
(deleting a const T* works, but directly calling ~T() on a const object
does not).

Alex, can you do the following? Please try replacing the
/boost/detail/allocator_utilities.hpp file in your local Boost copy
with the attached file and rebuild the multi_index_container code
that was failing. Does this fix it? If so, I'll commit this version into th=
trunk so that it'll be available in Boost 1.38 (though you can use it
now with your local Boost copy, of course).

Joaqu?n M L?pez Mu?oz
Telef?nica, Investigaci?n y Desarrollo
----------

This message and the information contained herein is proprietary and confidential and subject to the Amdocs policy statement,
you may review at http://www.amdocs.com/email_disclaimer.asp


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