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 // A program that necessitates the instantiation of template optional for 13 // (possibly cv-qualified) nullopt_t is ill-formed. 14 15 #include <optional> 16 17 int main(int, char**) 18 { 19 using std::optional; 20 using std::nullopt_t; 21 using std::nullopt; 22 23 optional<nullopt_t> opt; // expected-note 1 {{requested here}} 24 optional<const nullopt_t> opt1; // expected-note 1 {{requested here}} 25 optional<nullopt_t &> opt2; // expected-note 1 {{requested here}} 26 optional<nullopt_t &&> opt3; // expected-note 1 {{requested here}} 27 // expected-error@optional:* 4 {{instantiation of optional with nullopt_t is ill-formed}} 28 29 return 0; 30 } 31