-// 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
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>