From a370186824298735bac70a710815ae32f00a213f Mon Sep 17 00:00:00 2001 From: Antonio Maiorano Date: Tue, 14 Mar 2023 17:33:34 +0000 Subject: [PATCH] tint: Fix compilation on latest MSVC Change-Id: Ia0ebf98e5dc0c05f65af1593bb62e6a6971785b7 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124040 Commit-Queue: Antonio Maiorano Reviewed-by: Ben Clayton Kokoro: Kokoro --- src/tint/switch.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/tint/switch.h b/src/tint/switch.h index 51161958af..41bb99a741 100644 --- a/src/tint/switch.h +++ b/src/tint/switch.h @@ -215,13 +215,14 @@ inline auto Switch(T* object, CASES&&... cases) { auto try_case = [&](auto&& case_fn) { using CaseFunc = std::decay_t; using CaseType = detail::SwitchCaseType; + bool success = false; if constexpr (std::is_same_v) { if constexpr (kHasReturnType) { new (result) ReturnType(static_cast(case_fn(Default{}))); } else { case_fn(Default{}); } - return true; + success = true; } else { if (type_info.Is()) { auto* v = static_cast(object); @@ -230,10 +231,10 @@ inline auto Switch(T* object, CASES&&... cases) { } 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