Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / utilities / optional / optional.object / optional.object.observe / value_const.compile.fail.cpp
blob6dad6e3c6c6e4ab34dc3c39223c6d101badb0eae
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 const T& optional<T>::value() const &;
14 #include <optional>
15 #include <type_traits>
16 #include <cassert>
18 using std::optional;
20 struct X
22 constexpr int test() const {return 3;}
23 int test() {return 4;}
26 int main(int, char**)
29 constexpr optional<X> opt;
30 static_assert(opt.value().test() == 3, "");
33 return 0;