]> sourceware.org Git - systemtap.git/commitdiff
Add missing copy constructors to set1_ref and set1_const_ref
authorTimm Bäder <tbaeder@redhat.com>
Wed, 19 May 2021 20:28:29 +0000 (16:28 -0400)
committerAaron Merey <amerey@redhat.com>
Wed, 19 May 2021 20:28:29 +0000 (16:28 -0400)
Clang complains about the missing copy constructors if a user-defined
copy assignment operator exists, e.g.:

./bpf-bitset.h:108:19: error: definition of implicit copy constructor for 'set1_const_ref' is deprecated because it has a user-declared copy assignment operator [-Werror,-Wdeprecated-copy]
  set1_const_ref& operator= (const set1_const_ref &);   // not present
                  ^
./bpf-bitset.h:256:12: note: in implicit copy constructor for 'bpf::bitset::set1_const_ref' first required here
    return set1_const_ref(data + w2 * i, w2);

bpf-bitset.h

index db4eb08460531d7cf0aa874ee1a4c2e91d6999c1..6c2f74f0f9bcc3b347c2c396dcd5155c91a88252 100644 (file)
@@ -115,6 +115,7 @@ public:
   static const size_t npos = -1;
 
   set1_const_ref(word_t *d, size_t w) : data(d), words(w) { }
+  set1_const_ref(const set1_const_ref &o) : data(o.data), words(o.words) { }
 
   bool operator!= (const set1_const_ref &o) const
   {
@@ -149,6 +150,7 @@ private:
 
 public:
   set1_ref(size_t *d, size_t w) : set1_const_ref(d, w) { }
+  set1_ref(const set1_ref &o) : set1_const_ref(o.data, o.words) { }
 
   bit_ref operator[] (size_t i)
   {
This page took 0.027387 seconds and 5 git commands to generate.