Commit 8d6ca6e0 authored by Kenton Varda's avatar Kenton Varda

Fix build on non-MSVC compilers.

parent ebce4aa6
......@@ -567,7 +567,7 @@ public:
: segment(nullptr), ptr(nullptr), elementCount(0 * ELEMENTS),
step(0 * BITS / ELEMENTS) {}
MSVC_DEFAULT_ASSIGNMENT_WORKAROUND(, ListBuilder);
MSVC_DEFAULT_ASSIGNMENT_WORKAROUND(, ListBuilder)
inline word* getLocation() {
// Get the object's location.
......@@ -645,7 +645,7 @@ public:
: segment(nullptr), ptr(nullptr), elementCount(0), step(0 * BITS / ELEMENTS),
structDataSize(0), structPointerCount(0), nestingLimit(0x7fffffff) {}
MSVC_DEFAULT_ASSIGNMENT_WORKAROUND(const, ListReader);
MSVC_DEFAULT_ASSIGNMENT_WORKAROUND(const, ListReader)
inline ElementCount size() const;
// The number of elements in the list.
......
......@@ -127,7 +127,7 @@ inline void checkElement<double>(double a, double b) {
EXPECT_DOUBLE_EQ(a, b);
}
template <typename T, typename L = T::Reads>
template <typename T, typename L = typename T::Reads>
void checkList(T reader, std::initializer_list<decltype(reader[0])> expected) {
ASSERT_EQ(expected.size(), reader.size());
for (uint i = 0; i < expected.size(); i++) {
......@@ -135,11 +135,11 @@ void checkList(T reader, std::initializer_list<decltype(reader[0])> expected) {
}
}
template <typename T, typename L = T::Builds, bool = false>
void checkList(T reader, std::initializer_list<decltype(L::Reader()[0])> expected) {
template <typename T, typename L = typename T::Builds, bool = false>
void checkList(T reader, std::initializer_list<decltype(typename L::Reader()[0])> expected) {
ASSERT_EQ(expected.size(), reader.size());
for (uint i = 0; i < expected.size(); i++) {
checkElement<decltype(L::Reader()[0])>(expected.begin()[i], reader[i]);
checkElement<decltype(typename L::Reader()[0])>(expected.begin()[i], reader[i]);
}
}
......
......@@ -471,12 +471,20 @@ using MinType = typename MinType_<T, U, sizeof(T) <= sizeof(U)>::Type;
template <typename T, typename U>
inline KJ_CONSTEXPR() auto min(T&& a, U&& b) -> MinType<Decay<T>, Decay<U>> {
return MinType<Decay<T>, Decay<U>>(a < b ? a : b);
return a < b ? MinType<Decay<T>, Decay<U>>(a) : MinType<Decay<T>, Decay<U>>(b);
}
template <typename T, typename U, bool takeT> struct MaxType_;
template <typename T, typename U> struct MaxType_<T, U, true> { typedef T Type; };
template <typename T, typename U> struct MaxType_<T, U, false> { typedef U Type; };
template <typename T, typename U>
using MaxType = typename MaxType_<T, U, sizeof(T) >= sizeof(U)>::Type;
// Resolves to the larger of the two input types.
template <typename T, typename U>
inline KJ_CONSTEXPR() auto max(T&& a, U&& b) -> Decay<decltype(a > b ? a : b)> {
return a > b ? a : b;
inline KJ_CONSTEXPR() auto max(T&& a, U&& b) -> MaxType<Decay<T>, Decay<U>> {
return a > b ? MaxType<Decay<T>, Decay<U>>(a) : MaxType<Decay<T>, Decay<U>>(b);
}
template <typename T, size_t s>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment