Commit 34c2a169 authored by Kenton Varda's avatar Kenton Varda

Fix old GCC build.

parent 9816a0a4
...@@ -91,15 +91,11 @@ public: ...@@ -91,15 +91,11 @@ public:
} }
template <uint i> template <uint i>
KJ_NORETURN(void allHandled()) { KJ_NORETURN(void allHandled());
// After a series of if/else blocks handling each variant of the OneOf, have the final else // After a series of if/else blocks handling each variant of the OneOf, have the final else
// block call allHandled<n>() where n is the number of variants. This will fail to compile // block call allHandled<n>() where n is the number of variants. This will fail to compile
// if new variants are added in the future. // if new variants are added in the future.
static_assert(i == sizeof...(Variants), "new OneOf variants need to be handled here");
KJ_UNREACHABLE;
}
private: private:
uint tag; uint tag;
...@@ -169,6 +165,17 @@ private: ...@@ -169,6 +165,17 @@ private:
} }
}; };
template <typename... Variants>
template <uint i>
void OneOf<Variants...>::allHandled() {
// After a series of if/else blocks handling each variant of the OneOf, have the final else
// block call allHandled<n>() where n is the number of variants. This will fail to compile
// if new variants are added in the future.
static_assert(i == sizeof...(Variants), "new OneOf variants need to be handled here");
KJ_UNREACHABLE;
}
} // namespace kj } // namespace kj
#endif // KJ_ONE_OF_H_ #endif // KJ_ONE_OF_H_
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