Home | History | Annotate | Download | only in futures.unique_future
      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 // <future>
     13 
     14 // class future<R>
     15 
     16 // future(const future&) = delete;
     17 
     18 #include <future>
     19 
     20 #include "test_macros.h"
     21 
     22 int main()
     23 {
     24 #if TEST_STD_VER >= 11
     25     {
     26         std::future<int> f0;
     27         std::future<int> f = f0; // expected-error {{call to deleted constructor of 'std::future<int>'}}
     28     }
     29     {
     30         std::future<int &> f0;
     31         std::future<int &> f = f0; // expected-error {{call to deleted constructor of 'std::future<int &>'}}
     32     }
     33     {
     34         std::future<void> f0;
     35         std::future<void> f = f0; // expected-error {{call to deleted constructor of 'std::future<void>'}}
     36     }
     37 #else
     38     {
     39         std::future<int> f0;
     40         std::future<int> f = f0; // expected-error {{calling a private constructor of class 'std::__1::future<int>'}}
     41     }
     42     {
     43         std::future<int &> f0;
     44         std::future<int &> f = f0; // expected-error {{calling a private constructor of class 'std::__1::future<int &>'}}
     45     }
     46     {
     47         std::future<void> f0;
     48         std::future<void> f = f0; // expected-error {{calling a private constructor of class 'std::__1::future<void>'}}
     49     }
     50 #endif
     51 }
     52