1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14
12 // template <class T, class... Args>
13 // constexpr optional<T> make_optional(Args&&... args);
20 #include "test_macros.h"
25 constexpr auto opt
= std::make_optional
<int>('a');
26 static_assert(*opt
== int('a'));
29 std::string s
= "123";
30 auto opt
= std::make_optional
<std::string
>(s
);
31 assert(*opt
== "123");
34 std::unique_ptr
<int> s
= std::make_unique
<int>(3);
35 auto opt
= std::make_optional
<std::unique_ptr
<int>>(std::move(s
));
40 auto opt
= std::make_optional
<std::string
>(4u, 'X');
41 assert(*opt
== "XXXX");