]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/noexcept_move_construct.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 23_containers / unordered_multiset / cons / noexcept_move_construct.cc
index 4a1ada81becbb5fc0042f434760451dd793ba511..34be11db625b4c382df8a3eda4b980b6df3bcc17 100644 (file)
@@ -1,9 +1,6 @@
-// { dg-do compile }
-// { dg-options "-std=gnu++0x" }
+// { dg-do compile { target c++11 } }
 
-// 2011-06-01  Paolo Carlini  <paolo.carlini@oracle.com>
-//
-// Copyright (C) 2011 Free Software Foundation, Inc.
+// Copyright (C) 2020-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
 
 #include <unordered_set>
 
-typedef std::unordered_multiset<int> umstype;
+using type1 = std::unordered_multiset<int>;
+
+static_assert( std::is_nothrow_move_constructible<type1>::value,
+              "noexcept move constructor" );
+static_assert( std::is_nothrow_constructible<type1,
+              type1&&, const typename type1::allocator_type&>::value,
+              "noexcept move constructor with allocator" );
+
+struct not_noexcept_copy_cons_hash
+{
+  not_noexcept_copy_cons_hash() noexcept;
+  not_noexcept_copy_cons_hash(const not_noexcept_copy_cons_hash&) /* noexcept */;
+  not_noexcept_copy_cons_hash(not_noexcept_copy_cons_hash&&) noexcept;
+
+  std::size_t
+  operator()(int) const noexcept;
+};
+
+using type2 = std::unordered_multiset<int, not_noexcept_copy_cons_hash>;
+
+static_assert( !std::is_nothrow_move_constructible<type2>::value,
+              "not noexcept move constructor" );
+static_assert( !std::is_nothrow_constructible<type2, type2&&,
+              const typename type2::allocator_type&>::value,
+              "not noexcept move constructor with allocator" );
+
+struct not_noexcept_copy_cons_equal_to
+{
+  not_noexcept_copy_cons_equal_to() noexcept;
+  not_noexcept_copy_cons_equal_to(const not_noexcept_copy_cons_equal_to&) /* noexcept */;
+  not_noexcept_copy_cons_equal_to(not_noexcept_copy_cons_equal_to&&) noexcept;
+
+  bool
+  operator()(int, int) const noexcept;
+};
+
+using type3 = std::unordered_multiset<int, std::hash<int>,
+                                     not_noexcept_copy_cons_equal_to>;
 
-static_assert(std::is_nothrow_move_constructible<umstype>::value, "Error");
+static_assert( !std::is_nothrow_move_constructible<type3>::value,
+              "not noexcept move constructor" );
+static_assert( !std::is_nothrow_constructible<type3, type3&&,
+              const typename type3::allocator_type&>::value,
+              "not noexcept move constructor with allocator" );