libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

uses_allocator.pass.cpp (1120B)


      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // UNSUPPORTED: libcpp-has-no-threads
     11 
     12 // This test is marked XFAIL and not UNSUPPORTED because the non-variadic
     13 // declaration of packaged_task is available in C++03. Therefore the test
     14 // should fail because the static_assert fires and not because std::packaged_task
     15 // in undefined.
     16 // XFAIL: c++98, c++03
     17 
     18 // <future>
     19 // REQUIRES: c++11 || c++14
     20 // packaged_task allocator support was removed in C++17 (LWG 2976)
     21 
     22 // class packaged_task<R(ArgTypes...)>
     23 
     24 // template <class Callable, class Alloc>
     25 //   struct uses_allocator<packaged_task<Callable>, Alloc>
     26 //      : true_type { };
     27 
     28 #include <future>
     29 #include "test_allocator.h"
     30 
     31 int main()
     32 {
     33     static_assert((std::uses_allocator<std::packaged_task<double(int, char)>, test_allocator<int> >::value), "");
     34 }