Unverified Commit fc9a4e45 authored by Kenton Varda's avatar Kenton Varda Committed by GitHub

Merge pull request #753 from capnproto/fix-oneof

Make KJ_CASE_ONEOF work in templated contexts.
parents 1a936f71 8fb47afb
...@@ -246,8 +246,8 @@ void OneOf<Variants...>::allHandled() { ...@@ -246,8 +246,8 @@ void OneOf<Variants...>::allHandled() {
#endif #endif
#define KJ_CASE_ONEOF(name, ...) \ #define KJ_CASE_ONEOF(name, ...) \
break; \ break; \
case ::kj::Decay<decltype(*_kj_switch_subject)>::tagFor<__VA_ARGS__>(): \ case ::kj::Decay<decltype(*_kj_switch_subject)>::template tagFor<__VA_ARGS__>(): \
for (auto& name = _kj_switch_subject->get<__VA_ARGS__>(), *_kj_switch_done = &name; \ for (auto& name = _kj_switch_subject->template get<__VA_ARGS__>(), *_kj_switch_done = &name; \
_kj_switch_done; _kj_switch_done = nullptr) _kj_switch_done; _kj_switch_done = nullptr)
#define KJ_CASE_ONEOF_DEFAULT break; default: #define KJ_CASE_ONEOF_DEFAULT break; default:
// Allows switching over a OneOf. // Allows switching over a OneOf.
......
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