Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / utilities / optional / optional.object / optional.object.ctor / deduct.verify.cpp
blob0c887c683a8186e6b2ab40f8ea1399ebc2329180
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
11 // <optional>
13 // template<class T>
14 // optional(T) -> optional<T>;
16 #include <optional>
17 #include <cassert>
19 struct A {};
21 int main(int, char**)
23 // Test the explicit deduction guides
25 // Test the implicit deduction guides
27 // optional()
28 std::optional opt; // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'optional'}}
32 // optional(nullopt_t)
33 std::optional opt(std::nullopt); // expected-error-re@optional:* {{static assertion failed{{.*}}instantiation of optional with nullopt_t is ill-formed}}
36 return 0;