• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // any() noexcept;
15 
16 #include <any>
17 #include <type_traits>
18 #include <cassert>
19 
20 #include "test_macros.h"
21 #include "any_helpers.h"
22 #include "count_new.hpp"
23 
main()24 int main()
25 {
26     using std::any;
27     {
28         static_assert(
29             std::is_nothrow_default_constructible<any>::value
30           , "Must be default constructible"
31           );
32     }
33     {
34         struct TestConstexpr : public std::any {
35           constexpr TestConstexpr() : std::any() {}
36         };
37 #ifdef _LIBCPP_SAFE_STATIC
38         _LIBCPP_SAFE_STATIC static std::any a;
39         ((void)a);
40 #endif
41     }
42     {
43         DisableAllocationGuard g; ((void)g);
44         any const a;
45         assertEmpty(a);
46     }
47 }
48