optional_in_place_t.fail.cpp 818 B

1234567891011121314151617181920212223242526
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is dual licensed under the MIT and the University of Illinois Open
  6. // Source Licenses. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. // UNSUPPORTED: c++98, c++03, c++11, c++14
  10. // <optional>
  11. // A program that necessitates the instantiation of template optional for
  12. // (possibly cv-qualified) in_place_t is ill-formed.
  13. #include <optional>
  14. int main()
  15. {
  16. using std::optional;
  17. using std::in_place_t;
  18. using std::in_place;
  19. optional<in_place_t> opt; // expected-note {{requested here}}
  20. // expected-error@optional:* {{"instantiation of optional with in_place_t is ill-formed"}}
  21. }