1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // UNSUPPORTED: c++98, c++03, c++11, c++14
13 // constexpr bool optional<T>::has_value() const noexcept;
16 #include <type_traits>
19 #include "test_macros.h"
25 const optional<int> opt; ((void)opt);
26 ASSERT_NOEXCEPT(opt.has_value());
27 ASSERT_SAME_TYPE(decltype(opt.has_value()), bool);
30 constexpr optional<int> opt;
31 static_assert(!opt.has_value(), "");
34 constexpr optional<int> opt(0);
35 static_assert(opt.has_value(), "");