brintos

brintos / llvm-project-archived public Read only

0
0
Text · 873 B · 322ec2d Raw
34 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++1110 11// <propagate_const>12 13// template <class T> constexpr void propagate_const::swap(propagate_const<T>& x);14 15#include <experimental/propagate_const>16#include "test_macros.h"17#include "propagate_const_helpers.h"18#include <cassert>19 20using std::experimental::propagate_const;21 22bool swap_called = false;23void swap(X &, X &) { swap_called = true; }24 25int main(int, char**) {26  typedef propagate_const<X> P;27  P p1(1);28  P p2(2);29  p1.swap(p2);30  assert(swap_called);31 32  return 0;33}34