alloc_convert_copy.fail.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. // <tuple>
  10. // template <class... Types> class tuple;
  11. // template <class Alloc, class ...UTypes>
  12. // tuple(allocator_arg_t, const Alloc& a, tuple<UTypes...> const&);
  13. // UNSUPPORTED: c++98, c++03
  14. #include <tuple>
  15. #include <memory>
  16. struct ExplicitCopy {
  17. explicit ExplicitCopy(int) {}
  18. explicit ExplicitCopy(ExplicitCopy const&) {}
  19. };
  20. std::tuple<ExplicitCopy> const_explicit_copy_test() {
  21. const std::tuple<int> t1(42);
  22. return {std::allocator_arg, std::allocator<void>{}, t1};
  23. // expected-error@-1 {{chosen constructor is explicit in copy-initialization}}
  24. }
  25. std::tuple<ExplicitCopy> non_const_explicit_copy_test() {
  26. std::tuple<int> t1(42);
  27. return {std::allocator_arg, std::allocator<void>{}, t1};
  28. // expected-error@-1 {{chosen constructor is explicit in copy-initialization}}
  29. }
  30. int main()
  31. {
  32. }