[PATCH 4/8] Add missing copy constructors to set1_ref and set1_const_ref
Tom Stellard
tstellar@redhat.com
Mon Nov 30 19:58:37 GMT 2020
From: Timm Bäder <tbaeder@redhat.com>
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 | 2 ++
1 file changed, 2 insertions(+)
diff --git a/bpf-bitset.h b/bpf-bitset.h
index db4eb0846..6c2f74f0f 100644
--- a/bpf-bitset.h
+++ b/bpf-bitset.h
@@ -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)
{
--
2.26.2
More information about the Systemtap
mailing list