From 4daa3d591f6715671e6716a298ec39f0a34058c5 Mon Sep 17 00:00:00 2001 From: Sergey Date: Wed, 23 Oct 2024 10:43:55 -0700 Subject: [PATCH] Fix error: cannot use 'try' with exceptions disabled in Win LLVM Clang (#4208) 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 e0baae25..4d846f44 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) +# define FMT_USE_EXCEPTIONS 0 #elif FMT_MSC_VERSION && !_HAS_EXCEPTIONS # define FMT_USE_EXCEPTIONS 0 #else