This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Mark most test/std/future tests as UNSUPPORTED in C++03
ClosedPublic

Authored by EricWF on Aug 18 2015, 9:57 PM.

Details

Summary

This patch marks *most* tests for std::promise, std::future and std::shared_future as unsupported in C++03. These tests fail in C++03 mode because they attempt to copy a std::future even though it is a MoveOnly type. AFAIK the missing move-semantics in std::future is the only reason these tests fail but without move semantics these classes are useless. For example even though std::promise::set_value and std::promise::set_exception(...) work in C++03 std::promise is still useless because we cannot call std::promise::get_future(...).

It might be possible to hack std::move(...) like we do for std::unique_ptr to make the move semantics work but I don't think it is worth the effort. Instead I think we should leave the <future> header as-is and mark the failing tests as UNSUPPORTED. I don't believe there are any users of std::future or std::promise in C++03 because they are so unusable. Therefore I am not concerned about losing test coverage and possibly breaking users. However because there are still parts of <future> that work in C++03 it would be wrong to #ifdef out the entire header.

@mclow.lists Should we take further steps to prevent the use of std::promise, std::future and std::shared_future in C++03?

Note: This patch also cleans up the tests and converts them to use support/test_allocator.h instead of a duplicate class in test/std/futures/test_allocator.h.

Diff Detail

Event Timeline

EricWF updated this revision to Diff 32501.Aug 18 2015, 9:57 PM
EricWF retitled this revision from to [libcxx] Mark most test/std/future tests as UNSUPPORTED in C++03.
EricWF updated this object.
EricWF added a reviewer: mclow.lists.
EricWF added subscribers: cfe-commits, mclow.lists.
vsk added a subscriber: vsk.Aug 22 2015, 9:30 PM

Gentle ping. @mclow.lists I don't want a full review for this. Just a nod that I'm doing the right thing by not modifying <future>.

mclow.lists accepted this revision.Aug 27 2015, 9:55 PM
mclow.lists edited edge metadata.

This looks very mechanical, except for the changes to test_allocator.h, and that's a bug fix.

This revision is now accepted and ready to land.Aug 27 2015, 9:55 PM
EricWF updated this revision to Diff 33395.Aug 27 2015, 10:04 PM
EricWF edited edge metadata.

Reuploading without test_allocator change.

EricWF closed this revision.Aug 27 2015, 10:07 PM
test/std/thread/futures/futures.unique_future/wait_until.pass.cpp