]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libstdc++-v3/testsuite/20_util/allocator_traits/members/rebind_alloc.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / allocator_traits / members / rebind_alloc.cc
index 197c91dbe8202431903bfd5b2ee9bd10afb8cceb..241e169964c9ae594a52527485ab14f70693e540 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017-2019 Free Software Foundation, Inc.
+// Copyright (C) 2017-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
@@ -24,14 +24,15 @@ using std::is_same;
 template<typename T, typename U>
   using Rebind = typename std::allocator_traits<T>::template rebind_alloc<U>;
 
-template<typename T>
+template<typename T, typename = T>
   struct HasRebind {
     using value_type = T;
-    template<typename U> struct rebind { using other = std::allocator<U>; };
+    template<typename U> struct rebind { using other = HasRebind<U>; };
   };
 
-static_assert(is_same<Rebind<HasRebind<int>, long>,
-                     std::allocator<long>>::value,
+// Would get HasRebind<long, int> here if the first template argument is
+// replaced instead of using the nested rebind.
+static_assert(is_same<Rebind<HasRebind<int>, long>, HasRebind<long>>::value,
              "nested alias template is used");
 
 template<typename T>