[cfe-dev] thread(F&&) fails when F is not MoveAssignable
Gordon Henriksen
gordonhenriksen at me.com
Sun Dec 16 16:16:28 PST 2012
On 2012-12-16, at 15:49, Gordon Henriksen wrote:
> On 2012-12-16, at 15:36, Howard Hinnant wrote:
>
>> let's zero in on a precise copy/pasteable test.
>
> Agreed. I'm attempting to reduce a test case.
Found it; the correct reduction has one additional line:
#define decltype __typeof // CULPRIT
#ifdefing out that 'help' for clang permits the test to work without modification.
Reduction is below.
— Gordon
cat <<'EOT' >test.cpp
#define decltype __typeof // CULPRIT
#include <thread>
#include <iostream>
#include <cassert>
namespace {
class SimpleJoinThread {
bool &flag_;
public:
SimpleJoinThread(bool &flag) : flag_(flag) { }
void operator()() { flag_ = true; }
};
} // End anonymous namespace.
int main()
{
bool flag = false;
std::thread(SimpleJoinThread(flag)).join();
assert(flag);
}
EOT
xcrun clang++ -std=c++0x -stdlib=libc++ test.cpp
./test
More information about the cfe-dev
mailing list