public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Tom Stellard <tstellar@redhat.com>
To: systemtap@sourceware.org
Cc: "Timm Bäder" <tbaeder@redhat.com>
Subject: [PATCH 4/8] Add missing copy constructors to set1_ref and set1_const_ref
Date: Mon, 30 Nov 2020 19:58:37 +0000	[thread overview]
Message-ID: <20201130195841.26142-5-tstellar@redhat.com> (raw)
In-Reply-To: <20201130195841.26142-1-tstellar@redhat.com>

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


  parent reply	other threads:[~2020-11-30 19:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30 19:58 Clang build fixes Tom Stellard
2020-11-30 19:58 ` [PATCH 1/8] Fix a few class/struct mixups Tom Stellard
2020-11-30 19:58 ` [PATCH 2/8] util: Use abs() instead of labs() Tom Stellard
2020-11-30 19:58 ` [PATCH 3/8] Add some override specifiers where missing Tom Stellard
2020-11-30 19:58 ` Tom Stellard [this message]
2020-11-30 19:58 ` [PATCH 5/8] set2: Return this from assignment operator Tom Stellard
2020-11-30 19:58 ` [PATCH 6/8] Fix -Woverloaded-virtual warnings when building with clang Tom Stellard
2020-11-30 19:58 ` [PATCH 7/8] Fix -Wformat-nonliteral and -Wformat warnings " Tom Stellard
2020-11-30 19:58 ` [PATCH 8/8] dtrace: Use -o option to specify output file for CPP Tom Stellard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201130195841.26142-5-tstellar@redhat.com \
    --to=tstellar@redhat.com \
    --cc=systemtap@sourceware.org \
    --cc=tbaeder@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).