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, c++14
11
12// <any>
13
14// void swap(any &, any &) noexcept
15
16// swap(...) just wraps any::swap(...). That function is tested elsewhere.
17
18#include <any>
19#include <cassert>
20
21using std::any;
22using std::any_cast;
23
24int main()
25{
26
27    { // test noexcept
28        any a;
29        static_assert(noexcept(swap(a, a)), "swap(any&, any&) must be noexcept");
30    }
31    {
32        any a1(1);
33        any a2(2);
34
35        swap(a1, a2);
36
37        assert(any_cast<int>(a1) == 2);
38        assert(any_cast<int>(a2) == 1);
39    }
40}
41