1a9e65961SEric Fiselier //===----------------------------------------------------------------------===//
2a9e65961SEric Fiselier //
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
6a9e65961SEric Fiselier //
7a9e65961SEric Fiselier //===----------------------------------------------------------------------===//
8a9e65961SEric Fiselier 
9*31cbe0f2SLouis Dionne // UNSUPPORTED: c++03, c++11, c++14
10a9e65961SEric Fiselier // <optional>
11a9e65961SEric Fiselier 
12a9e65961SEric Fiselier // A program that necessitates the instantiation of template optional for
13a9e65961SEric Fiselier // (possibly cv-qualified) nullopt_t is ill-formed.
14a9e65961SEric Fiselier 
15a9e65961SEric Fiselier #include <optional>
16a9e65961SEric Fiselier 
main(int,char **)172df59c50SJF Bastien int main(int, char**)
18a9e65961SEric Fiselier {
19a9e65961SEric Fiselier     using std::optional;
20a9e65961SEric Fiselier     using std::nullopt_t;
21a9e65961SEric Fiselier     using std::nullopt;
22a9e65961SEric Fiselier 
23a9e65961SEric Fiselier     optional<nullopt_t> opt; // expected-note 1 {{requested here}}
24a9e65961SEric Fiselier     optional<const nullopt_t> opt1; // expected-note 1 {{requested here}}
25a9e65961SEric Fiselier     optional<nullopt_t &> opt2; // expected-note 1 {{requested here}}
26a9e65961SEric Fiselier     optional<nullopt_t &&> opt3; // expected-note 1 {{requested here}}
27a9e65961SEric Fiselier     // expected-error@optional:* 4 {{instantiation of optional with nullopt_t is ill-formed}}
282df59c50SJF Bastien 
292df59c50SJF Bastien   return 0;
30a9e65961SEric Fiselier }
31