]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common: Clang requires a default constructor, but it can be empty 28131/head
authorWillem Jan Withagen <wjw@digiware.nl>
Mon, 29 Apr 2019 08:57:40 +0000 (10:57 +0200)
committerJason Dillaman <dillaman@redhat.com>
Wed, 15 May 2019 20:00:52 +0000 (16:00 -0400)
Just do what the error messages ask for.

Error from Clang:
```
In file included from /home/jenkins/workspace/ceph-master/src/cls/rbd/cls_rbd.cc:28:
In file included from /home/jenkins/workspace/ceph-master/src/objclass/../include/types.h:21:
In file included from /home/jenkins/workspace/ceph-master/src/include/uuid.h:9:
In file included from /home/jenkins/workspace/ceph-master/src/include/encoding.h:17:
In file included from /usr/include/c++/v1/set:426:
In file included from /usr/include/c++/v1/__tree:16:
/usr/include/c++/v1/memory:2241:41: error: call to implicitly-deleted default constructor of '__compressed_pair_elem<ceph::BitVector<'\x02'>::NoInitAllocator, 1>'
      : _Base1(std::forward<_Tp>(__t)), _Base2() {}
                                        ^
/usr/include/c++/v1/vector:437:7: note: in instantiation of function template specialization 'std::__1::__compressed_pair<unsigned int *, ceph::BitVector<'\x02'>::NoInitAllocator>::__compressed_pair<nullptr_t, true>' requested here
      __end_cap_(nullptr)
      ^
/usr/include/c++/v1/vector:496:5: note: in instantiation of member function 'std::__1::__vector_base<unsigned int, ceph::BitVector<'\x02'>::NoInitAllocator>::__vector_base' requested here
    vector() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
    ^
/home/jenkins/workspace/ceph-master/src/common/bit_vector.hpp:163:3: note: in instantiation of member function 'std::__1::vector<unsigned int, ceph::BitVector<'\x02'>::NoInitAllocator>::vector' requested here
  BitVector();
  ^
/home/jenkins/workspace/ceph-master/src/cls/rbd/cls_rbd.cc:3289:16: note: in instantiation of member function 'ceph::BitVector<'\x02'>::BitVector' requested here
  BitVector<2> object_map;
               ^
/usr/include/c++/v1/memory:2179:39: note: explicitly defaulted function was implicitly deleted here
  _LIBCPP_INLINE_VISIBILITY constexpr __compressed_pair_elem() = default;
                                      ^
/usr/include/c++/v1/memory:2172:50: note: default constructor of '__compressed_pair_elem<ceph::BitVector<'\x02'>::NoInitAllocator, 1, true>' is implicitly deleted because base class 'ceph::BitVector<'\x02'>::NoInitAllocator' has no default constructor
struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp {
                                                 ^
1 error generated.

```

Fixes: http://tracker.ceph.com/issues/39561
Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
(cherry picked from commit 3eb760580ff6e03a318f3e89711d629a03bc6dd5)

src/common/bit_vector.hpp

index c51dc532c3505ba86756075a8f80a084641b6416..0ffce1b295523d789f268ce0df14d513bd82358d 100644 (file)
@@ -224,6 +224,7 @@ public:
   static void generate_test_instances(std::list<BitVector *> &o);
 private:
   struct NoInitAllocator : public std::allocator<__u32> {
+    NoInitAllocator() {}
     NoInitAllocator(const std::allocator<__u32>& alloc)
       : std::allocator<__u32>(alloc) {
     }