Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / utilities / optional / optional.nullopt / nullopt_t.pass.cpp
blob842b75893cbe4c3fc66988cdd89c2fb86cd9d53d
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 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14
10 // <optional>
12 // struct nullopt_t{see below};
13 // inline constexpr nullopt_t nullopt(unspecified);
15 // [optional.nullopt]/2:
16 // Type nullopt_t shall not have a default constructor or an initializer-list
17 // constructor, and shall not be an aggregate.
19 #include <optional>
20 #include <type_traits>
22 #include "test_macros.h"
24 using std::nullopt_t;
25 using std::nullopt;
27 constexpr bool test()
29 nullopt_t foo{nullopt};
30 (void)foo;
31 return true;
34 int main(int, char**)
36 static_assert(std::is_empty_v<nullopt_t>);
37 static_assert(!std::is_default_constructible_v<nullopt_t>);
39 static_assert(std::is_same_v<const nullopt_t, decltype(nullopt)>);
40 static_assert(test());
42 return 0;