]> granicus.if.org Git - pdns/commitdiff
Fix `DSRecordContent::operator==` hiding virtual `DNSRecordContent::operator==`
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 16 Jan 2017 16:48:49 +0000 (17:48 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 16 Jan 2017 16:49:47 +0000 (17:49 +0100)
Hopefully we should be able to enable `-Woverloaded-virtual` soon.

pdns/dnsrecords.hh

index 97c66d00524716191703f4b37de7cfe2b695f3c8..e3eed1ef27a311cfcbca1c256a28a987352759e6 100644 (file)
@@ -340,10 +340,13 @@ class DSRecordContent : public DNSRecordContent
 {
 public:
   DSRecordContent();
-  bool operator==(const DSRecordContent& rhs) const
+  bool operator==(const DNSRecordContent& rhs) const override
   {
+    if(typeid(*this) != typeid(rhs))
+      return false;
+    auto rrhs =dynamic_cast<const decltype(this)>(&rhs);
     return tie(d_tag, d_algorithm, d_digesttype, d_digest) ==
-      tie(rhs.d_tag, rhs.d_algorithm, rhs.d_digesttype, rhs.d_digest);
+      tie(rrhs->d_tag, rrhs->d_algorithm, rrhs->d_digesttype, rrhs->d_digest);
   }
   bool operator<(const DSRecordContent& rhs) const
   {