Skip to content

use of deleted function 'TrackingStdAllocator<T>::TrackingStdAllocator() #38

Description

@zssty2010

Cause a compile error!
https://github.com/zilliztech/milvus-common/blame/3ab63a97429eb1880abb3eaeb55a0bbe3bf6d281/include/common/TrackingStdAllocator.h#L79

/milvus/internal/core/src/segcore/InsertRecord.h:632:77: required from here
/include/c++/9/bits/stl_tree.h:684:22: error: use of deleted function 'TrackingStdAllocator<T>::TrackingStdAllocator() [with T = std::_Rb_tree_node<std::pair<const std::__cxx11::basic_string<char>, std::vector<long int> > >]'
684 | : _Node_allocator()
| ^
In file included from /milvus/internal/core/src/segcore/InsertRecord.h:27,

std::make_shared<std::atomic<size_t>>(0) may throw an exception, making the member initialization of counter_ non-noexcept. This causes the implicitly generated default constructor to lose its noexcept specification, conflicting with your explicitly declared noexcept = default. Consequently, the compiler deletes the constructor, resulting in compilation failure.

so I deleted the noexcept keyword and then compiled successfully, Perhaps you can fix it by making the counter_ member safe?

--- a/include/common/TrackingStdAllocator.h
+++ b/include/common/TrackingStdAllocator.h
@@ -30,2 +30,2 @@
- TrackingStdAllocator() noexcept = default;
+ TrackingStdAllocator() = default;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions