Skip to content

call of overloaded ‘destroy_n(std::__cxx11::basic_string<char>*, immer::detail::rbts::count_t&)’ is ambiguous #219

Closed
@tusooa

Description

Source

#include <string>
#include <iostream>

#include <immer/flex_vector.hpp>


int main()
{
    immer::flex_vector<std::string> m{"a"};
    immer::flex_vector<std::string> n{"a"};

    auto p = m + n;
}

Result

] c++ immer-test.cpp
In file included from /usr/include/immer/detail/rbts/rrbtree.hpp:12,
                 from /usr/include/immer/flex_vector.hpp:11,
                 from immer-test.cpp:5:
/usr/include/immer/detail/rbts/node.hpp: In instantiation of ‘static immer::detail::rbts::node<T, MemoryPolicy, B, BL>::node_t* immer::detail::rbts::node<T, MemoryPolicy, B, BL>::copy_leaf(immer::detail::rbts::node<T, MemoryPolicy, B, BL>::node_t*, immer::detail::rbts::count_t, immer::detail::rbts::node<T, MemoryPolicy, B, BL>::node_t*, immer::detail::rbts::count_t) [with T = std::__cxx11::basic_string<char>; MemoryPolicy = immer::memory_policy<immer::free_list_heap_policy<immer::cpp_heap>, immer::refcount_policy, immer::spinlock_policy>; unsigned int B = 5; unsigned int BL = 3; immer::detail::rbts::node<T, MemoryPolicy, B, BL>::node_t = immer::detail::rbts::node<std::__cxx11::basic_string<char>, immer::memory_policy<immer::free_list_heap_policy<immer::cpp_heap>, immer::refcount_policy, immer::spinlock_policy>, 5, 3>; immer::detail::rbts::count_t = unsigned int]’:
/usr/include/immer/detail/rbts/rrbtree.hpp:717:38:   required from ‘immer::detail::rbts::rrbtree<T, MemoryPolicy, B, BL> immer::detail::rbts::rrbtree<T, MemoryPolicy, B, BL>::concat(const immer::detail::rbts::rrbtree<T, MemoryPolicy, B, BL>&) const [with T = std::__cxx11::basic_string<char>; MemoryPolicy = immer::memory_policy<immer::free_list_heap_policy<immer::cpp_heap>, immer::refcount_policy, immer::spinlock_policy>; unsigned int B = 5; unsigned int BL = 3]’
/usr/include/immer/flex_vector.hpp:400:30:   required from ‘immer::flex_vector<std::__cxx11::basic_string<char> > immer::operator+(const immer::flex_vector<std::__cxx11::basic_string<char> >&, const immer::flex_vector<std::__cxx11::basic_string<char> >&)’
immer-test.cpp:13:18:   required from here
/usr/include/immer/detail/rbts/node.hpp:660:22: error: call of overloaded ‘destroy_n(std::__cxx11::basic_string<char>*, immer::detail::rbts::count_t&)’ is ambiguous
  660 |             destroy_n(dst->leaf(), n1);
      |             ~~~~~~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/immer/detail/rbts/node.hpp:14,
                 from /usr/include/immer/detail/rbts/rrbtree.hpp:12,
                 from /usr/include/immer/flex_vector.hpp:11,
                 from immer-test.cpp:5:
/usr/include/immer/detail/util.hpp:82:6: note: candidate: ‘std::enable_if_t<(! can_trivially_detroy<Iter>), Iter> immer::detail::destroy_n(Iter, Size) [with Iter = std::__cxx11::basic_string<char>*; Size = unsigned int; std::enable_if_t<(! can_trivially_detroy<Iter>), Iter> = std::__cxx11::basic_string<char>*]’
   82 | auto destroy_n(Iter first, Size n) noexcept
      |      ^~~~~~~~~
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/bits/alloc_traits.h:33,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/ext/alloc_traits.h:34,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/bits/basic_string.h:40,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/string:55,
                 from immer-test.cpp:2:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/bits/stl_construct.h:258:5: note: candidate: ‘_ForwardIterator std::destroy_n(_ForwardIterator, _Size) [with _ForwardIterator = std::__cxx11::basic_string<char>*; _Size = unsigned int]’
  258 |     destroy_n(_ForwardIterator __first, _Size __count)
      |     ^~~~~~~~~

Environment

] c++ --version
c++ (Gentoo 11.3.0 p4) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions