optional_in_place_t.fail.cpp 855 B

123456789101112131415161718192021222324252627
  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. // UNSUPPORTED: c++98, c++03, c++11, c++14
  9. // <optional>
  10. // A program that necessitates the instantiation of template optional for
  11. // (possibly cv-qualified) in_place_t is ill-formed.
  12. #include <optional>
  13. int main(int, char**)
  14. {
  15. using std::optional;
  16. using std::in_place_t;
  17. using std::in_place;
  18. optional<in_place_t> opt; // expected-note {{requested here}}
  19. // expected-error@optional:* {{"instantiation of optional with in_place_t is ill-formed"}}
  20. return 0;
  21. }