| 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 | // <optional> |
| 11 | |
| 12 | // template <class T> |
| 13 | // class optional |
| 14 | // { |
| 15 | // public: |
| 16 | // typedef T value_type; |
| 17 | // ... |
| 18 | |
| 19 | #include <optional> |
| 20 | #include <type_traits> |
| 21 | |
| 22 | #include "test_macros.h" |
| 23 | |
| 24 | using std::optional; |
| 25 | |
| 26 | template <class Opt, class T> |
| 27 | void |
| 28 | test() |
| 29 | { |
| 30 | static_assert(std::is_same<typename Opt::value_type, T>::value, "" ); |
| 31 | } |
| 32 | |
| 33 | int main(int, char**) |
| 34 | { |
| 35 | test<optional<int>, int>(); |
| 36 | test<optional<const int>, const int>(); |
| 37 | test<optional<double>, double>(); |
| 38 | test<optional<const double>, const double>(); |
| 39 | |
| 40 | return 0; |
| 41 | } |
| 42 | |