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-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // UNSUPPORTED: c++98, c++03, c++11, c++14
10 
11 // <any>
12 
13 // any() noexcept;
14 
15 #include <any>
16 #include <type_traits>
17 #include <cassert>
18 
19 #include "test_macros.h"
20 #include "any_helpers.h"
21 #include "count_new.h"
22 
23 int main(int, char**)
24 {
25     using std::any;
26     {
27         static_assert(
28             std::is_nothrow_default_constructible<any>::value
29           , "Must be default constructible"
30           );
31     }
32     {
33         struct TestConstexpr : public std::any {
34           constexpr TestConstexpr() : std::any() {}
35         };
36 #ifdef _LIBCPP_SAFE_STATIC
37         _LIBCPP_SAFE_STATIC static std::any a;
38         ((void)a);
39 #endif
40     }
41     {
42         DisableAllocationGuard g; ((void)g);
43         any const a;
44         assertEmpty(a);
45     }
46 
47   return 0;
48 }
49