]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-kvstore-tool: define a noexcept non-default ctor for Deleter 39711/head
authorKefu Chai <kchai@redhat.com>
Fri, 26 Feb 2021 01:38:26 +0000 (09:38 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 2 Mar 2021 10:26:23 +0000 (18:26 +0800)
the deleter of a unique_ptr<> should be value-initialized if we use
`unique_ptr()` for constructing the unique_ptr, but somehow, `Deleter`
does have a user-defined constructor which prevents the compiler from
creating a default constructor which could have made Deleter default
constructible.

in this change, a constructor accepts no arguments is explictly defined
to satisfy the requirements for creating `db` using `unique_ptr<>()`.

this change is not cherry-picked from master, as we don't define a
constructor at all for Deleter, so it is *always* value-initialized.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/tools/ceph_kvstore_tool.cc

index ee7a3b7439bd476a07175ebb099363ed7e875fcd..fd7c9aefe172a864c344be322298dd6bcadf6c13 100644 (file)
@@ -39,8 +39,11 @@ class StoreTool
 #ifdef HAVE_LIBAIO
   struct Deleter {
     BlueStore *bluestore;
-    Deleter(BlueStore *store = nullptr)
-    : bluestore(store)
+    Deleter()
+      : bluestore(nullptr)
+    {}
+    Deleter(BlueStore *store)
+      : bluestore(store)
     {}
     void operator()(KeyValueDB *db) {
       if (bluestore) {