From eb59b4c4ab94a3cfb6cdacefcbaf7ea1cf578df4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Dziepak?= Date: Thu, 22 Sep 2016 14:29:31 +0100 Subject: [PATCH] keys: disable constructing from generic range MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit stdx::optional uses quite elaborate std::enable_if_t magic to decide whether the argument passed to its constructor should be used for a call T constructor or stdx::optional constructor. Apparently, with GCC 6.2 having T constructor which accepts any type confuses that magic and we end up with compile errors. The solution is to have from_range() method that replaces that constructor from range. There is also constructor that creates a key from std::vector so that code generated by IDL works as it did before. Signed-off-by: Paweł Dziepak Message-Id: <1474550971-15309-1-git-send-email-pdziepak@scylladb.com> --- keys.hh | 18 +++++++++++++----- sstables/sstables.cc | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/keys.hh b/keys.hh index e6ac630697..0570821691 100644 --- a/keys.hh +++ b/keys.hh @@ -168,7 +168,7 @@ public: template static TopLevel from_exploded(RangeOfSerializedComponents&& v) { - return TopLevel(std::forward(v)); + return TopLevel::from_range(std::forward(v)); } static TopLevel from_exploded(const schema& s, const std::vector& v) { @@ -615,8 +615,12 @@ public: using c_type = compound_type; template - partition_key(RangeOfSerializedComponents&& v) - : compound_wrapper(managed_bytes(c_type::serialize_value(std::forward(v)))) + static partition_key from_range(RangeOfSerializedComponents&& v) { + return partition_key(managed_bytes(c_type::serialize_value(std::forward(v)))); + } + + partition_key(std::vector v) + : compound_wrapper(managed_bytes(c_type::serialize_value(std::move(v)))) { } partition_key(partition_key&& v) = default; @@ -705,8 +709,12 @@ class clustering_key_prefix : public prefix_compound_wrapper - clustering_key_prefix(RangeOfSerializedComponents&& v) - : prefix_compound_wrapper(compound::element_type::serialize_value(std::forward(v))) + static clustering_key_prefix from_range(RangeOfSerializedComponents&& v) { + return clustering_key_prefix(compound::element_type::serialize_value(std::forward(v))); + } + + clustering_key_prefix(std::vector v) + : prefix_compound_wrapper(compound::element_type::serialize_value(std::move(v))) { } clustering_key_prefix(clustering_key_prefix&& v) = default; diff --git a/sstables/sstables.cc b/sstables/sstables.cc index e052b929f8..e87515adde 100644 --- a/sstables/sstables.cc +++ b/sstables/sstables.cc @@ -1242,7 +1242,7 @@ void sstable::maybe_flush_pi_block(file_writer& out, // block size of new data. if (!clustering_key.empty()) { auto& rts = _pi_write.tombstone_accumulator->range_tombstones_for_row( - clustering_key_prefix(clustering_key.values())); + clustering_key_prefix::from_range(clustering_key.values())); for (const auto& rt : rts) { auto start = composite::from_clustering_element(*_pi_write.schemap, rt.start); auto end = composite::from_clustering_element(*_pi_write.schemap, rt.end);