diff options
Diffstat (limited to 'libstdc++-v3/testsuite/23_containers/vector/allocator/swap.cc')
-rw-r--r-- | libstdc++-v3/testsuite/23_containers/vector/allocator/swap.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/libstdc++-v3/testsuite/23_containers/vector/allocator/swap.cc b/libstdc++-v3/testsuite/23_containers/vector/allocator/swap.cc index 808753e7520..2ca19db1713 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/allocator/swap.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/allocator/swap.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2011 Free Software Foundation +// Copyright (C) 2011-2012 Free Software Foundation // // 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 @@ -25,6 +25,23 @@ struct T { int i; }; using __gnu_test::propagating_allocator; +// It is undefined behaviour to swap() containers wth unequal allocators +// if the allocator doesn't propagate, so ensure the allocators compare +// equal, while still being able to test propagation via get_personality(). +bool +operator==(const propagating_allocator<T, false>&, + const propagating_allocator<T, false>&) +{ + return true; +} + +bool +operator!=(const propagating_allocator<T, false>&, + const propagating_allocator<T, false>&) +{ + return false; +} + void test01() { bool test __attribute__((unused)) = true; |