| 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 | // A program that necessitates the instantiation of template optional for |
| 14 | // (possibly cv-qualified) nullopt_t is ill-formed. |
| 15 | |
| 16 | #include <optional> |
| 17 | |
| 18 | void f() { |
| 19 | std::optional<std::nullopt_t> opt; // expected-note 1 {{requested here}} |
| 20 | std::optional<const std::nullopt_t> opt1; // expected-note 1 {{requested here}} |
| 21 | std::optional<std::nullopt_t &> opt2; // expected-note 1 {{requested here}} |
| 22 | std::optional<std::nullopt_t &&> opt3; // expected-note 1 {{requested here}} |
| 23 | // expected-error@optional:* 4 {{instantiation of optional with nullopt_t is ill-formed}} |
| 24 | } |
| 25 | |