Debian Codegraph @

libcxx/test/std/utilities/any/any.class/any.cons/default.pass.cpp

raw
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++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 {
26 static_assert(
27 std::is_nothrow_default_constructible<std::any>::value
28 , "Must be default constructible"
29 );
30 }
31 {
32 struct TestConstexpr : public std::any {
33 constexpr TestConstexpr() : std::any() {}
34 };
35 static TEST_CONSTINIT std::any a;
36 (void)a;
37 }
38 {
39 DisableAllocationGuard g; ((void)g);
40 const std::any a;
41 assertEmpty(a);
42 }
43
44 return 0;
45 }