Home | History | Annotate | Download | only in futures.promise
      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& operator=(const promise& rhs) = 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::promise<int> p0, p;
     27         p = p0; // expected-error {{overload resolution selected deleted operator '='}}
     28     }
     29     {
     30         std::promise<int&> p0, p;
     31         p = p0; // expected-error {{overload resolution selected deleted operator '='}}
     32     }
     33     {
     34         std::promise<void> p0, p;
     35         p = p0; // expected-error {{overload resolution selected deleted operator '='}}
     36     }
     37 #else
     38     {
     39         std::promise<int> p0, p;
     40         p = p0; // expected-error {{'operator=' is a private member of 'std::__1::promise<int>'}}
     41     }
     42     {
     43         std::promise<int&> p0, p;
     44         p = p0; // expected-error {{'operator=' is a private member of 'std::__1::promise<int &>'}}
     45     }
     46     {
     47         std::promise<void> p0, p;
     48         p = p0; // expected-error {{'operator=' is a private member of 'std::__1::promise<void>'}}
     49     }
     50 #endif
     51 }
     52