From 67bb7f5af43904d538b2882cb19f19ddc55d250d Mon Sep 17 00:00:00 2001 From: Sergey Markelov Date: Sun, 20 Oct 2024 11:27:34 -0700 Subject: [PATCH] Fix error: cannot use 'try' with exceptions disabled in Win LLVM Clang Fixes #4207. LLVM Clang on Windows does not define `__GNUC__`. The preprocessor falls to `#elif FMT_MSC_VERSION && !_HAS_EXCEPTIONS` with `_HAS_EXCEPTIONS 1` defined in vcruntime.h:104. --- include/fmt/base.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/fmt/base.h b/include/fmt/base.h index e0baae256347..7de2365cd60b 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -146,6 +146,8 @@ // Use the provided definition. #elif defined(__GNUC__) && !defined(__EXCEPTIONS) # define FMT_USE_EXCEPTIONS 0 +#elif defined(__clang__) && (!defined(__cpp_exceptions) || __cpp_exceptions < 199711L) +# define FMT_USE_EXCEPTIONS 0 #elif FMT_MSC_VERSION && !_HAS_EXCEPTIONS # define FMT_USE_EXCEPTIONS 0 #else