]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libstdc++-v3/testsuite/20_util/tuple/cons/allocators.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / tuple / cons / allocators.cc
index eb444f76cbeb7b3be91b4c9bba8e90f7d2a24bd9..9a5c745cb26646c66d60a0e03b20383a6ca59f9a 100644 (file)
@@ -1,6 +1,8 @@
 // { dg-do run { target c++11 } }
+// FIXME [!HOSTED]: avoidable std::allocator usage
+// { dg-require-effective-target hosted }
 
-// Copyright (C) 2011-2018 Free Software Foundation, Inc.
+// Copyright (C) 2011-2024 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -181,9 +183,38 @@ void test02()
   test_type empty = make_tuple();
 }
 
+void test03()
+{
+  struct dr2586
+  {
+    using allocator_type = std::allocator<int>;
+    dr2586() { }
+    dr2586(std::allocator_arg_t, allocator_type&&) { }
+    dr2586(const allocator_type&) : expected(true) { }
+    bool expected = false;
+  };
+
+  const dr2586::allocator_type a;
+  std::tuple<dr2586> t{std::allocator_arg, a};
+  VERIFY( std::get<0>(t).expected );
+}
+
+void test04()
+{
+  struct X {
+    X(std::allocator_arg_t) { }
+  };
+
+  // The element types are not default constructible, so the allocator-extended
+  // default constructor should not participate in overload resolution.
+  std::tuple<X, void(&)()> t(std::allocator_arg, *+[]{});
+}
+
 int main()
 {
   test01();
   test02();
+  test03();
+  test04();
   return 0;
 }