From bc621a95ca9ab169fb8ea5999b81e395413603d5 Mon Sep 17 00:00:00 2001 From: huangqinjin Date: Sun, 13 Apr 2025 22:17:59 +0800 Subject: [PATCH] Fix compilation on VS2017 (#1143) The compiler complains about C2131: expression did not evaluate to a constant. https://godbolt.org/z/a198P3bdM --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- include/CLI/impl/StringTools_inl.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/CLI/impl/StringTools_inl.hpp b/include/CLI/impl/StringTools_inl.hpp index eb062d0f..72736daa 100644 --- a/include/CLI/impl/StringTools_inl.hpp +++ b/include/CLI/impl/StringTools_inl.hpp @@ -327,7 +327,11 @@ CLI11_INLINE std::size_t close_sequence(const std::string &str, std::size_t star return close_string_quote(str, start, closure_char); case 1: case 2: +#if defined(_MSC_VER) && _MSC_VER < 1920 + case(std::size_t)-1: +#else case std::string::npos: +#endif return close_literal_quote(str, start, closure_char); default: break;