|
Boost : |
Subject: [boost] [Thread] possible bug in Move emulation "portable interface"
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2013-09-04 01:53:49
I tried submitting this via Trac but for some reason it was convinced
that my bug report contained spam, while refusing to tell me what part
it was objecting to, and also refusing to give me a captcha or anything
to convince it otherwise.
Anyways:
Bug 1: the Boost.Thread documentation and release history indicate that
BOOST_THREAD_VERSION==3 is the default since v1.52. As far as I can
tell this has never been true in any released version; the latest code
still has ==2. (I found a thread in boost-devel that was debating
consequences of making breaking changes by default, which I assume is
why this change was not actually made; but the docs need correcting.)
Bug 2: when writing code using the Boost.Thread "Portable Interface" for
move support/emulation, it recommends using the
BOOST_THREAD_DCL_MOVABLE_BEG macro to "avoid conflicts with Boost.Move".
However regardless of C++11 or not or the BOOST_THREAD_VERSION it
defines a template specialisation in a way that assumes that it is
called only from "namespace boost". As this usage is unlikely for any
code outside the boost library itself, I think this is a bug.
namespace user
{
template<typename T>
class test
{
public:
BOOST_THREAD_COPYABLE_AND_MOVABLE(test)
test() {}
test(const test&) {}
test& operator=(BOOST_COPY_ASSIGN_REF(test) o) { return *this; }
test(BOOST_THREAD_RV_REF(test) o) {}
test& operator=(BOOST_THREAD_RV_REF(test) o) { return *this; }
};
BOOST_THREAD_DCL_MOVABLE_BEG(T) test<T> BOOST_THREAD_DCL_MOVABLE_END }
The above code will not compile. It does compile if the DCL define is
moved into a "namespace boost" block, but I do not regard this as an
acceptable solution.
Suggested fix is to explicitly specify the namespace in the macro, eg.
replace "enable_move_utility_emulation" with
"::boost::enable_move_utility_emulation".
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk