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

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 18 21:57:39 PDT 2015


EricWF created this revision.
EricWF added a reviewer: mclow.lists.
EricWF added subscribers: cfe-commits, mclow.lists.

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`.

http://reviews.llvm.org/D12135

Files:
  test/libcxx/thread/futures/version.pass.cpp
  test/std/thread/futures/futures.promise/alloc_ctor.pass.cpp
  test/std/thread/futures/futures.promise/copy_assign.fail.cpp
  test/std/thread/futures/futures.promise/copy_ctor.fail.cpp
  test/std/thread/futures/futures.promise/default.pass.cpp
  test/std/thread/futures/futures.promise/dtor.pass.cpp
  test/std/thread/futures/futures.promise/get_future.pass.cpp
  test/std/thread/futures/futures.promise/move_assign.pass.cpp
  test/std/thread/futures/futures.promise/move_ctor.pass.cpp
  test/std/thread/futures/futures.promise/set_exception.pass.cpp
  test/std/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp
  test/std/thread/futures/futures.promise/set_lvalue.pass.cpp
  test/std/thread/futures/futures.promise/set_lvalue_at_thread_exit.pass.cpp
  test/std/thread/futures/futures.promise/set_value_at_thread_exit_const.pass.cpp
  test/std/thread/futures/futures.promise/set_value_at_thread_exit_void.pass.cpp
  test/std/thread/futures/futures.promise/set_value_const.pass.cpp
  test/std/thread/futures/futures.promise/set_value_void.pass.cpp
  test/std/thread/futures/futures.promise/swap.pass.cpp
  test/std/thread/futures/futures.promise/uses_allocator.pass.cpp
  test/std/thread/futures/futures.shared_future/copy_assign.pass.cpp
  test/std/thread/futures/futures.shared_future/copy_ctor.pass.cpp
  test/std/thread/futures/futures.shared_future/ctor_future.pass.cpp
  test/std/thread/futures/futures.shared_future/dtor.pass.cpp
  test/std/thread/futures/futures.shared_future/get.pass.cpp
  test/std/thread/futures/futures.shared_future/move_assign.pass.cpp
  test/std/thread/futures/futures.shared_future/move_ctor.pass.cpp
  test/std/thread/futures/futures.shared_future/wait.pass.cpp
  test/std/thread/futures/futures.shared_future/wait_for.pass.cpp
  test/std/thread/futures/futures.shared_future/wait_until.pass.cpp
  test/std/thread/futures/futures.unique_future/copy_assign.fail.cpp
  test/std/thread/futures/futures.unique_future/copy_ctor.fail.cpp
  test/std/thread/futures/futures.unique_future/dtor.pass.cpp
  test/std/thread/futures/futures.unique_future/get.pass.cpp
  test/std/thread/futures/futures.unique_future/share.pass.cpp
  test/std/thread/futures/futures.unique_future/wait.pass.cpp
  test/std/thread/futures/futures.unique_future/wait_for.pass.cpp
  test/std/thread/futures/futures.unique_future/wait_until.pass.cpp
  test/std/thread/futures/test_allocator.h
  test/std/thread/futures/version.pass.cpp
  test/support/test_allocator.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12135.32501.patch
Type: text/x-patch
Size: 58556 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150819/511222e5/attachment-0001.bin>


More information about the cfe-commits mailing list