test: cql_query_test: don't use std::pow() in constexpr context

std::pow() is not constexpr, and clang correctly refuses to assign
its result in constexpr context. Add a constexpr replacement.
This commit is contained in:
Avi Kivity
2020-09-21 15:37:04 +03:00
parent bf8c8d292a
commit 70ea785cc7

View File

@@ -3196,6 +3196,14 @@ SEASTAR_TEST_CASE(test_static_multi_cell_static_lists_with_ckey) {
});
}
// std::pow() is not constexpr
static constexpr int constexpr_int_pow(int x, unsigned y) {
int ret = 1;
for (unsigned i = 0; i < y; ++i) {
ret *= x;
}
return ret;
}
/**
* A class to represent a single multy-column slice expression.
@@ -3234,7 +3242,7 @@ public:
/**
* The mapping of tuples is to integers between 0 and this value.
*/
static const int total_num_of_values = std::pow(Base,Digits);
static const int total_num_of_values = constexpr_int_pow(Base, Digits);
/**
* Consructor for the testcase