Home | History | Annotate | Download | only in propagate_const.nonmembers
      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: c++98, c++03, c++11
     11 
     12 // <propagate_const>
     13 
     14 // template <class T> constexpr void swap(propagate_const<T>& x, propagate_const<T>& y);
     15 
     16 #include <experimental/propagate_const>
     17 #include "propagate_const_helpers.h"
     18 #include <cassert>
     19 
     20 using std::experimental::propagate_const;
     21 
     22 bool swap_called = false;
     23 void swap(X &, X &) { swap_called = true; }
     24 
     25 int main() {
     26   typedef propagate_const<X> P;
     27   P p1(1);
     28   P p2(2);
     29   swap(p1, p2);
     30   assert(swap_called);
     31 }
     32