1f660fc658f05cdc8dca68c43409fb78c56b631b
[platform/upstream/llvm.git] /
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 //===----------------------------------------------------------------------===//
8
9 // UNSUPPORTED: c++03, c++11, c++14
10 // <optional>
11
12 // constexpr const T& optional<T>::operator*() const &;
13
14 // UNSUPPORTED: libcxx-no-debug-mode
15
16 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
17
18 #include <optional>
19
20 #include "test_macros.h"
21 #include "debug_macros.h"
22
23 int main(int, char**) {
24     const std::optional<int> opt;
25     TEST_LIBCPP_ASSERT_FAILURE(*opt, "optional operator* called on a disengaged value");
26
27     return 0;
28 }