-// { dg-options "-std=gnu++0x" }
+// { dg-do run { target c++11 } }
+// FIXME [!HOSTED]: avoidable std::allocator usage
+// { dg-require-effective-target hosted }
-// Copyright (C) 2011-2014 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
void test01()
{
- bool test __attribute__((unused)) = true;
using std::allocator_arg;
using std::tuple;
using std::make_tuple;
}
+void test02()
+{
+ using std::allocator_arg;
+ using std::tuple;
+ using std::make_tuple;
+
+ typedef tuple<> test_type;
+
+ MyAlloc a;
+
+ // default construction
+ test_type t1(allocator_arg, a);
+ // copy construction
+ test_type t2(allocator_arg, a, t1);
+ // move construction
+ test_type t3(allocator_arg, a, std::move(t1));
+ // make_tuple
+ 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;
}