Boost logo

Boost :

Subject: Re: [boost] [config] clang deleted functions bugged
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2013-11-04 02:02:50


Le 28/10/13 03:23, Vicente J. Botet Escriba a écrit :
> Le 28/10/13 02:54, Jonathan Wakely a écrit :
>> On 28 October 2013 01:45, Jonathan Wakely wrote:
>>> On 28 October 2013 00:12, Vicente J. Botet Escriba wrote:
>>>> Boost.Thread defines a private constructor when
>>>> BOOST_NO_CXX11_DELETED_FUNCTIONS is defined and in this case there
>>>> is no
>>>> compiler error.
>>> That might be true, but that is not sufficient to conclude that clang
>>> doesn't support deleted functions!
>>>
>>> The stackoverflow question you linked to is years old and Howard's
>>> answer is wrong (but Johannes's comments on that answer are correct,
>>> and agree with what Peter already said.)
>>>
>>> The stack trace shows that std::vector is trying to copy the element,
>>> not move it.
>>>
>>> My guess would be that boost::thread's move constructor is not
>>> noexcept, so the libc++ std::vector refuses to use a move when
>>> inserting, and falls back to a copy instead, which fails. That is the
>>> correct, standard behaviour for std::vector. If my guess is correct
>>> you should make the move constructor noexcept.
>> Yep, here's your bug:
>>
>> thread(BOOST_THREAD_RV_REF(thread) x)
>> {
>> thread_info=BOOST_THREAD_RV(x).thread_info;
>> BOOST_THREAD_RV(x).thread_info.reset();
>> }
>>
>> That is missing a BOOST_NOEXCEPT exception-specification.
> You are right, I missed it. And adding it fixes the issue I had.
> Thanks so much.
> My apologies for the noise. Hopping others have learn something from
> you insight.
>> Why not simply do x.thread_info.swap(thread_info) to avoid ref-count
>> updates in that constructor?
> I will change it.
>>
>> Also, there's a bogus copyright date in boost/thread/detail/thread.hpp:
>>
>> // (C) Copyright 20011-2012 Vicente J. Botet Escriba
>>
>>
> Thanks for catching this ;-)
>
>
Done, https://svn.boost.org/trac/boost/changeset/86493
Vicente


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