variant_reference.fail.cpp 841 B

12345678910111213141516171819202122232425262728
  1. // -*- C++ -*-
  2. //===----------------------------------------------------------------------===//
  3. //
  4. // The LLVM Compiler Infrastructure
  5. //
  6. // This file is dual licensed under the MIT and the University of Illinois Open
  7. // Source Licenses. See LICENSE.TXT for details.
  8. //
  9. //===----------------------------------------------------------------------===//
  10. // UNSUPPORTED: c++98, c++03, c++11, c++14
  11. // <variant>
  12. // template <class ...Types> class variant;
  13. #include <variant>
  14. #include "test_macros.h"
  15. #include "variant_test_helpers.hpp"
  16. int main()
  17. {
  18. // expected-error@variant:* 3 {{static_assert failed}}
  19. std::variant<int, int&> v; // expected-note {{requested here}}
  20. std::variant<int, int const&> v2; // expected-note {{requested here}}
  21. std::variant<int, int&&> v3; // expected-note {{requested here}}
  22. }