From 3b5c377ce5d19531b15eb3969ee43620da77ca7f Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 8 Feb 2024 12:22:24 +0100 Subject: [PATCH] Debugger: Fix custom allocator dumper tests for GCC >= 13 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GCC commit [1] commit 64c986b49558a7c356b85bda85195216936c29a3 Author: Jonathan Wakely Date: Wed Dec 14 15:21:32 2022 +0000 libstdc++: Diagnose broken allocator rebind members added a static_assert that caused the dumper tests using custom allocators to fail like this on Debian testing: DEBUG : tst_Dumpers::dumper(StdBasicString) qtc.debugger.dumpers: In file included from /usr/include/c++/13/ext/alloc_traits.h:34, from /usr/include/c++/13/bits/basic_string.h:39, from /usr/include/c++/13/string:54, from main.cpp:28: /usr/include/c++/13/bits/alloc_traits.h: In instantiation of ‘struct std::__allocator_traits_base::__rebind, char, void>’: /usr/include/c++/13/bits/alloc_traits.h:94:11: required by substitution of ‘template using std::__alloc_rebind = typename std::__allocator_traits_base::__rebind<_Alloc, _Up>::type [with _Alloc = myallocator; _Up = char]’ /usr/include/c++/13/bits/alloc_traits.h:228:8: required by substitution of ‘template template using std::allocator_traits< >::rebind_alloc = std::__alloc_rebind<_Alloc, _Tp> [with _Tp = char; _Alloc = myallocator]’ /usr/include/c++/13/ext/alloc_traits.h:126:65: required from ‘struct __gnu_cxx::__alloc_traits, char>::rebind’ /usr/include/c++/13/bits/basic_string.h:90:24: required from ‘class std::__cxx11::basic_string, myallocator >’ main.cpp:56:71: required from here /usr/include/c++/13/bits/alloc_traits.h:70:31: error: static assertion failed: allocator_traits::rebind_alloc must be A 70 | _Tp>::value, | ^~~~~ /usr/include/c++/13/bits/alloc_traits.h:70:31: note: ‘std::integral_constant::value’ evaluates to false make: *** [Makefile:506: main.o] Error 1 Override the rebind behavior of the custom allocator used in the tests to fix this. [1] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=64c986b49558a7 Change-Id: I1cd8370e5f1601b710e28c251061291c65ac44ce Reviewed-by: hjk Reviewed-by: Qt CI Bot --- tests/auto/debugger/tst_dumpers.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 69fcf3bcf2c..613eb9c72bb 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -5264,7 +5264,12 @@ void tst_Dumpers::dumper_data() << Data("#include \n" "template\n" - "class myallocator : public std::allocator {};\n", + "class myallocator : public std::allocator {\n" + "template\n" + "struct rebind {\n" + "typedef myallocator<_Tp1> other;\n" + "};\n" + "};\n", "std::basic_string, myallocator> str(\"hello\");", @@ -5418,6 +5423,10 @@ void tst_Dumpers::dumper_data() "template\n" "class myallocator : public std::allocator {\n" "using std::allocator::allocator;\n" + "template\n" + "struct rebind {\n" + "typedef myallocator<_Tp1> other;\n" + "};\n" "};\n", "std::vector v0, v1;\n"