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// XFAIL: with_system_cxx_lib=macosx10.12
13// XFAIL: with_system_cxx_lib=macosx10.11
14// XFAIL: with_system_cxx_lib=macosx10.10
15// XFAIL: with_system_cxx_lib=macosx10.9
16// XFAIL: with_system_cxx_lib=macosx10.7
17// XFAIL: with_system_cxx_lib=macosx10.8
18
19// <any>
20
21// any::reset() noexcept
22
23#include <any>
24#include <cassert>
25
26#include "any_helpers.h"
27
28int main()
29{
30    using std::any;
31    using std::any_cast;
32    // empty
33    {
34        any a;
35
36        // noexcept check
37        static_assert(
38            noexcept(a.reset())
39          , "any.reset() must be noexcept"
40          );
41
42        assertEmpty(a);
43
44        a.reset();
45
46        assertEmpty(a);
47    }
48    // small object
49    {
50        any a((small(1)));
51        assert(small::count == 1);
52        assertContains<small>(a, 1);
53
54        a.reset();
55
56        assertEmpty<small>(a);
57        assert(small::count == 0);
58    }
59    // large object
60    {
61        any a(large(1));
62        assert(large::count == 1);
63        assertContains<large>(a, 1);
64
65        a.reset();
66
67        assertEmpty<large>(a);
68        assert(large::count == 0);
69    }
70}
71