1a9e65961SEric Fiselier //===----------------------------------------------------------------------===// 2a9e65961SEric Fiselier // 357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6a9e65961SEric Fiselier // 7a9e65961SEric Fiselier //===----------------------------------------------------------------------===// 8a9e65961SEric Fiselier 9*31cbe0f2SLouis Dionne // UNSUPPORTED: c++03, c++11, c++14 10a9e65961SEric Fiselier // <optional> 11a9e65961SEric Fiselier 12a9e65961SEric Fiselier // constexpr explicit optional<T>::operator bool() const noexcept; 13a9e65961SEric Fiselier 14a9e65961SEric Fiselier #include <optional> 15a9e65961SEric Fiselier #include <type_traits> 16a9e65961SEric Fiselier #include <cassert> 17a9e65961SEric Fiselier 18a9e65961SEric Fiselier #include "test_macros.h" 19a9e65961SEric Fiselier main(int,char **)202df59c50SJF Bastienint main(int, char**) 21a9e65961SEric Fiselier { 22a9e65961SEric Fiselier using std::optional; 23a9e65961SEric Fiselier { 24a9e65961SEric Fiselier const optional<int> opt; ((void)opt); 25a9e65961SEric Fiselier ASSERT_NOEXCEPT(bool(opt)); 26a9e65961SEric Fiselier static_assert(!std::is_convertible<optional<int>, bool>::value, ""); 27a9e65961SEric Fiselier } 28a9e65961SEric Fiselier { 29a9e65961SEric Fiselier constexpr optional<int> opt; 30a9e65961SEric Fiselier static_assert(!opt, ""); 31a9e65961SEric Fiselier } 32a9e65961SEric Fiselier { 33a9e65961SEric Fiselier constexpr optional<int> opt(0); 34a9e65961SEric Fiselier static_assert(opt, ""); 35a9e65961SEric Fiselier } 362df59c50SJF Bastien 372df59c50SJF Bastien return 0; 38a9e65961SEric Fiselier } 39