1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14
12 // constexpr explicit optional<T>::operator bool() const noexcept;
15 #include <type_traits>
18 #include "test_macros.h"
24 const optional
<int> opt
; ((void)opt
);
25 ASSERT_NOEXCEPT(bool(opt
));
26 static_assert(!std::is_convertible
<optional
<int>, bool>::value
, "");
29 constexpr optional
<int> opt
;
30 static_assert(!opt
, "");
33 constexpr optional
<int> opt(0);
34 static_assert(opt
, "");