[PATCH] Fix test memory_resource to work without sized deallocation

Jonathan Wakely jwakely@redhat.com
Fri Mar 1 13:50:00 GMT 2019


The checking memory_resource in the testsuite assumes sized deallocation
is supported, which might not be true for other compilers.

	* testsuite/util/testsuite_allocator.h (__gnu_test::memory_resource)
	[!__cpp_sized_deallocation]: Do not pass size to operator delete.

Tested powerpc64le-linux, committed to trunk.


-------------- next part --------------
commit 9cc2b31ce0e23c7bae5f1e065628baec934478c6
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Mar 1 13:33:25 2019 +0000

    Fix test memory_resource to work without sized deallocation
    
    The checking memory_resource in the testsuite assumes sized deallocation
    is supported, which might not be true for other compilers.
    
            * testsuite/util/testsuite_allocator.h (__gnu_test::memory_resource)
            [!__cpp_sized_deallocation]: Do not pass size to operator delete.

diff --git a/libstdc++-v3/testsuite/util/testsuite_allocator.h b/libstdc++-v3/testsuite/util/testsuite_allocator.h
index 044b9d5a90f..627749299d2 100644
--- a/libstdc++-v3/testsuite/util/testsuite_allocator.h
+++ b/libstdc++-v3/testsuite/util/testsuite_allocator.h
@@ -780,7 +780,11 @@ namespace __gnu_test
 		  throw bad_size();
 		if (alignment != a->alignment)
 		  throw bad_alignment();
+#if __cpp_sized_deallocation
 		::operator delete(p, bytes, std::align_val_t(alignment));
+#else
+		::operator delete(p, std::align_val_t(alignment));
+#endif
 		*aptr = a->next;
 		a->next = lists->freed;
 		lists->freed = a;


More information about the Libstdc++ mailing list