variant_void.fail.cpp 981 B

12345678910111213141516171819202122232425262728293031323334
  1. // -*- C++ -*-
  2. //===----------------------------------------------------------------------===//
  3. //
  4. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  5. // See https://llvm.org/LICENSE.txt for license information.
  6. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  7. //
  8. //===----------------------------------------------------------------------===//
  9. // UNSUPPORTED: c++98, c++03, c++11, c++14
  10. // <variant>
  11. // template <class ...Types> class variant;
  12. #include <variant>
  13. #include <type_traits>
  14. #include <string>
  15. #include <cassert>
  16. #include "test_macros.h"
  17. #include "variant_test_helpers.h"
  18. #include "test_convertible.h"
  19. int main(int, char**)
  20. {
  21. // expected-error@variant:* 3 {{static_assert failed}}
  22. std::variant<int, void> v; // expected-note {{requested here}}
  23. std::variant<int, const void> v2; // expected-note {{requested here}}
  24. std::variant<const volatile void, int> v3; // expected-note {{requested here}}
  25. return 0;
  26. }