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>
diff --git a/src/tint/switch.h b/src/tint/switch.h
index 5116195..41bb99a 100644
--- a/src/tint/switch.h
+++ b/src/tint/switch.h
@@ -215,13 +215,14 @@
auto try_case = [&](auto&& case_fn) {
using CaseFunc = std::decay_t<decltype(case_fn)>;
using CaseType = detail::SwitchCaseType<CaseFunc>;
+ bool success = false;
if constexpr (std::is_same_v<CaseType, Default>) {
if constexpr (kHasReturnType) {
new (result) ReturnType(static_cast<ReturnType>(case_fn(Default{})));
} else {
case_fn(Default{});
}
- return true;
+ success = true;
} else {
if (type_info.Is<CaseType>()) {
auto* v = static_cast<CaseType*>(object);
@@ -230,10 +231,10 @@
} else {
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