[Mips] Add the missing judgment when processing function handleMFLOSlot (#121463)
[llvm-project.git] / libcxx / test / std / utilities / optional / optional.object / optional.object.observe / has_value.pass.cpp
blob6998e023022c52a4790e7a7815c2dfc0e4bd5c12
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 // constexpr bool optional<T>::has_value() const noexcept;
14 #include <optional>
15 #include <type_traits>
16 #include <cassert>
18 #include "test_macros.h"
20 int main(int, char**)
22 using std::optional;
24 const optional<int> opt; ((void)opt);
25 ASSERT_NOEXCEPT(opt.has_value());
26 ASSERT_SAME_TYPE(decltype(opt.has_value()), bool);
29 constexpr optional<int> opt;
30 static_assert(!opt.has_value(), "");
33 constexpr optional<int> opt(0);
34 static_assert(opt.has_value(), "");
37 return 0;