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