1f35b4bc3SMarshall Clow //===----------------------------------------------------------------------===//
2f35b4bc3SMarshall Clow //
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
6f35b4bc3SMarshall Clow //
7f35b4bc3SMarshall Clow //===----------------------------------------------------------------------===//
8f35b4bc3SMarshall Clow 
931cbe0f2SLouis Dionne // UNSUPPORTED: c++03, c++11, c++14
105425106eSLouis Dionne 
115425106eSLouis Dionne // <optional>
12f35b4bc3SMarshall Clow 
13f35b4bc3SMarshall Clow // template<class T>
14f35b4bc3SMarshall Clow //   optional(T) -> optional<T>;
15f35b4bc3SMarshall Clow 
16f35b4bc3SMarshall Clow #include <optional>
17f35b4bc3SMarshall Clow #include <cassert>
18f35b4bc3SMarshall Clow 
19f35b4bc3SMarshall Clow struct A {};
20f35b4bc3SMarshall Clow 
main(int,char **)212df59c50SJF Bastien int main(int, char**)
22f35b4bc3SMarshall Clow {
23f35b4bc3SMarshall Clow //  Test the explicit deduction guides
24f35b4bc3SMarshall Clow 
25f35b4bc3SMarshall Clow //  Test the implicit deduction guides
26f35b4bc3SMarshall Clow     {
27f35b4bc3SMarshall Clow //  optional()
285425106eSLouis Dionne     std::optional opt;   // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'optional'}}
29f35b4bc3SMarshall Clow     }
30f35b4bc3SMarshall Clow 
31f35b4bc3SMarshall Clow     {
32f35b4bc3SMarshall Clow //  optional(nullopt_t)
33*76476efdSMuhammad Usman Shahid     std::optional opt(std::nullopt);   // expected-error-re@optional:* {{{{(static_assert|static assertion)}} failed{{.*}}instantiation of optional with nullopt_t is ill-formed}}
34f35b4bc3SMarshall Clow     }
352df59c50SJF Bastien 
362df59c50SJF Bastien   return 0;
37f35b4bc3SMarshall Clow }
38