From 4903f40efe7b0c193309708ea01bd6abea8bac16 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Sun, 11 Jun 2023 00:41:14 -0400 Subject: [PATCH] settings_setting: Fix errors ToString didn't have a constexpr if statement where needed. Canonicalize missed an else, causing unreachable code error on MSVC. --- src/common/settings_setting.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common/settings_setting.h b/src/common/settings_setting.h index f226e38d4..99a4bad01 100644 --- a/src/common/settings_setting.h +++ b/src/common/settings_setting.h @@ -142,7 +142,7 @@ protected: return value_.has_value() ? std::to_string(*value_) : "none"; } else if constexpr (std::is_same()) { return value_ ? "true" : "false"; - } else if (std::is_same()) { + } else if constexpr (std::is_same()) { return CanonicalizeEnum(value_); } else { return std::to_string(static_cast(value_)); @@ -222,8 +222,9 @@ public: [[nodiscard]] std::string constexpr Canonicalize() const override { if constexpr (std::is_enum::value) { return CanonicalizeEnum(this->GetValue()); + } else { + return ToString(this->GetValue()); } - return ToString(this->GetValue()); } /**