tint: Fix compilation on latest MSVC
Change-Id: Ia0ebf98e5dc0c05f65af1593bb62e6a6971785b7 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124040 Commit-Queue: Antonio Maiorano <amaiorano@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
a2c7639a46
commit
a370186824
|
@ -215,13 +215,14 @@ inline auto Switch(T* object, CASES&&... cases) {
|
||||||
auto try_case = [&](auto&& case_fn) {
|
auto try_case = [&](auto&& case_fn) {
|
||||||
using CaseFunc = std::decay_t<decltype(case_fn)>;
|
using CaseFunc = std::decay_t<decltype(case_fn)>;
|
||||||
using CaseType = detail::SwitchCaseType<CaseFunc>;
|
using CaseType = detail::SwitchCaseType<CaseFunc>;
|
||||||
|
bool success = false;
|
||||||
if constexpr (std::is_same_v<CaseType, Default>) {
|
if constexpr (std::is_same_v<CaseType, Default>) {
|
||||||
if constexpr (kHasReturnType) {
|
if constexpr (kHasReturnType) {
|
||||||
new (result) ReturnType(static_cast<ReturnType>(case_fn(Default{})));
|
new (result) ReturnType(static_cast<ReturnType>(case_fn(Default{})));
|
||||||
} else {
|
} else {
|
||||||
case_fn(Default{});
|
case_fn(Default{});
|
||||||
}
|
}
|
||||||
return true;
|
success = true;
|
||||||
} else {
|
} else {
|
||||||
if (type_info.Is<CaseType>()) {
|
if (type_info.Is<CaseType>()) {
|
||||||
auto* v = static_cast<CaseType*>(object);
|
auto* v = static_cast<CaseType*>(object);
|
||||||
|
@ -230,10 +231,10 @@ inline auto Switch(T* object, CASES&&... cases) {
|
||||||
} else {
|
} else {
|
||||||
case_fn(v);
|
case_fn(v);
|
||||||
}
|
}
|
||||||
return true;
|
success = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return success;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Use a logical-or fold expression to try each of the cases in turn, until one matches the
|
// Use a logical-or fold expression to try each of the cases in turn, until one matches the
|
||||||
|
|
Loading…
Reference in New Issue