ALT Linux Bugzilla
– Attachment 13443 Details for
Bug 46440
MySQL: ошибка сборки с GCC 13
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
патч для stl_allocator-t.cc
0001-stl_alloc-t.cc-fixed-compilation-error-with-GCC-13.patch (text/plain), 4.44 KB, created by
Alexey Sheplyakov
on 2023-06-08 15:53:26 MSK
(
hide
)
Description:
патч для stl_allocator-t.cc
Filename:
MIME Type:
Creator:
Alexey Sheplyakov
Created:
2023-06-08 15:53:26 MSK
Size:
4.44 KB
patch
obsolete
>From fd1c1dd658221dcccbaeeac5c6ae644fab274019 Mon Sep 17 00:00:00 2001 >From: Alexey Sheplyakov <asheplyakov@basealt.ru> >Date: Thu, 8 Jun 2023 12:25:32 +0000 >Subject: [PATCH 1/3] stl_alloc-t.cc: fixed compilation error with GCC 13 > >In file included from /usr/include/c++/13/ext/alloc_traits.h:34, > from /usr/include/c++/13/bits/stl_uninitialized.h:64, > from /usr/include/c++/13/memory:69, > from /usr/src/RPM/BUILD/MySQL-8.0.30/extra/googletest/googletest-release-1.11.0/googletest/include/gtest/gtest.h:57, > from /usr/src/RPM/BUILD/MySQL-8.0.30/unittest/gunit/stl_alloc-t.cc:23: >/usr/include/c++/13/bits/alloc_traits.h: In instantiation of 'struct std::__allocator_traits_base::__rebind<stlalloc_unittest::Mem_root_allocator_wrapper<std::unique_ptr<int> >, std::unique_ptr<int>, void>': >/usr/include/c++/13/bits/alloc_traits.h:94:11: required by substitution of 'template<class _Alloc, class _Up> using std::__alloc_rebind = typename std::__allocator_traits_base::__rebind<_Alloc, _Up>::type [with _Alloc = stlalloc_unittest::Mem_root_allocator_wrapper<std::unique_ptr<int> >; _Up = std::unique_ptr<int>]' >/usr/include/c++/13/bits/alloc_traits.h:228:8: required by substitution of 'template<class _Alloc> template<class _Tp> using std::allocator_traits< <template-parameter-1-1> >::rebind_alloc = std::__alloc_rebind<_Alloc, _Tp> [with _Tp = std::unique_ptr<int>; _Alloc = stlalloc_unittest::Mem_root_allocator_wrapper<std::unique_ptr<int> >]' >/usr/include/c++/13/ext/alloc_traits.h:126:65: required from 'struct __gnu_cxx::__alloc_traits<stlalloc_unittest::Mem_root_allocator_wrapper<std::unique_ptr<int> >, std::unique_ptr<int> >::rebind<std::unique_ptr<int> >' >/usr/include/c++/13/bits/stl_vector.h:88:21: required from 'struct std::_Vector_base<std::unique_ptr<int>, stlalloc_unittest::Mem_root_allocator_wrapper<std::unique_ptr<int> > >' >/usr/include/c++/13/bits/stl_vector.h:423:11: required from 'class std::vector<std::unique_ptr<int>, stlalloc_unittest::Mem_root_allocator_wrapper<std::unique_ptr<int> > >' >/usr/src/RPM/BUILD/MySQL-8.0.30/unittest/gunit/stl_alloc-t.cc:406:43: required from 'void stlalloc_unittest::STLAllocTestMoveOnly_MoveOnly_Test<gtest_TypeParam_>::TestBody() [with gtest_TypeParam_ = stlalloc_unittest::Mem_root_allocator_wrapper<std::unique_ptr<int> >]' >/usr/src/RPM/BUILD/MySQL-8.0.30/unittest/gunit/stl_alloc-t.cc:405:1: required from here >/usr/include/c++/13/bits/alloc_traits.h:70:31: error: static assertion failed: allocator_traits<A>::rebind_alloc<A::value_type> must be A > 70 | _Tp>::value, > | ^~~~~ >/usr/include/c++/13/bits/alloc_traits.h:70:31: note: 'std::integral_constant<bool, false>::value' evaluates to false > >To avoid the failure properly override `rebind` in Mem_root_allocator_wrapper >and implement conversion constructors (same for Malloc_allocator_wrapper). >--- > unittest/gunit/stl_alloc-t.cc | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > >diff --git a/unittest/gunit/stl_alloc-t.cc b/unittest/gunit/stl_alloc-t.cc >index 08316235409..fb1ce07ddd0 100644 >--- a/unittest/gunit/stl_alloc-t.cc >+++ b/unittest/gunit/stl_alloc-t.cc >@@ -57,6 +57,14 @@ template <typename T> > class Malloc_allocator_wrapper : public Malloc_allocator<T> { > public: > Malloc_allocator_wrapper() : Malloc_allocator<T>(PSI_NOT_INSTRUMENTED) {} >+ >+ template<class U> >+ Malloc_allocator_wrapper(const Malloc_allocator_wrapper<U> &other [[maybe_unused]]) >+ : Malloc_allocator<T>(PSI_NOT_INSTRUMENTED) {} >+ template <class U> >+ struct rebind { >+ typedef Malloc_allocator_wrapper<U> other; >+ }; > }; > > template <typename T> >@@ -69,6 +77,12 @@ class Mem_root_allocator_wrapper : public Mem_root_allocator<T> { > m_mem_root.set_error_handler(nullptr); > } > >+ template <class U> >+ Mem_root_allocator_wrapper(const Mem_root_allocator_wrapper<U> &other [[maybe_unused]]) >+ : Mem_root_allocator<T>(&m_mem_root) { >+ m_mem_root.set_error_handler(nullptr); >+ } >+ > /* > Allocators before C++17 need to be copy-constructible, and libc++ enforces > this (libstdc++ is fine with them being move-only). As a hack, we implement >@@ -82,6 +96,11 @@ class Mem_root_allocator_wrapper : public Mem_root_allocator<T> { > : Mem_root_allocator<T>(&m_mem_root) { > memcpy(&m_mem_root, &other.m_mem_root, sizeof(m_mem_root)); > } >+ >+ template <class U> >+ struct rebind { >+ typedef Mem_root_allocator_wrapper<U> other; >+ }; > }; > > /* >-- >2.33.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 46440
: 13443 |
13444