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
11 // <optional>
12
13 // template<class T>
14 // optional(T) -> optional<T>;
15
16 #include <optional>
17 #include <cassert>
18
19 struct A {};
20
main(int,char **)21 int main(int, char**)
22 {
23 // Test the explicit deduction guides
24
25 // Test the implicit deduction guides
26 {
27 // optional()
28 std::optional opt; // expected-error-re {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}optional'}}
29 }
30
31 {
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}}
34 }
35
36 return 0;
37 }
38