summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Dekker <N.Dekker@lumc.nl>2025-05-15 10:24:24 +0200
committerGitHub <noreply@github.com>2025-05-15 11:24:24 +0300
commit8eb4012353d80696e624c0685cbd0baa69772a46 (patch)
treefe6dee1655c90d0e2a0bed2cff01b764bc587452
parent5abab000e33923f6808f068a081418c0bc7274da (diff)
downloadProject-Tick-8eb4012353d80696e624c0685cbd0baa69772a46.tar.gz
Project-Tick-8eb4012353d80696e624c0685cbd0baa69772a46.zip
TOML_DISABLE_NOEXCEPT_NOEXCEPT workaround MSVC bug noexcept + modules (#271)
-rw-r--r--include/toml++/impl/preprocessor.hpp16
-rw-r--r--include/toml++/impl/value.hpp7
-rw-r--r--toml.hpp17
3 files changed, 36 insertions, 4 deletions
diff --git a/include/toml++/impl/preprocessor.hpp b/include/toml++/impl/preprocessor.hpp
index 54f2f95bf5..ff2ce6dd23 100644
--- a/include/toml++/impl/preprocessor.hpp
+++ b/include/toml++/impl/preprocessor.hpp
@@ -1252,6 +1252,22 @@ TOML_ENABLE_WARNINGS;
/// These compile errors were reported by Kevin Dick, Jan 19, 2024, at https://github.com/marzer/tomlplusplus/issues/219
//# }}
+#ifndef TOML_DISABLE_NOEXCEPT_NOEXCEPT
+#define TOML_DISABLE_NOEXCEPT_NOEXCEPT 0
+ #ifdef _MSC_VER
+ #if _MSC_VER <= 1943 // Up to Visual Studio 2022 Version 17.13.6
+ #undef TOML_DISABLE_NOEXCEPT_NOEXCEPT
+ #define TOML_DISABLE_NOEXCEPT_NOEXCEPT 1
+ #endif
+ #endif
+#endif
+//# {{
+/// \def TOML_DISABLE_NOEXCEPT_NOEXCEPT
+/// \brief Disable using noexcept(noexcept(<expression>)) within the toml++ library implementation.
+/// \detail This macro offers a workaround to a bug in Visual C++ (Visual Studio 2022), which caused
+/// compile errors, saying: "error C3878: syntax error: unexpected token ',' following 'simple-type-specifier'"
+//# }}
+
/// @}
//#====================================================================================================================
//# CHARCONV SUPPORT
diff --git a/include/toml++/impl/value.hpp b/include/toml++/impl/value.hpp
index 16cc7a3a97..b6bcc5d7b0 100644
--- a/include/toml++/impl/value.hpp
+++ b/include/toml++/impl/value.hpp
@@ -266,8 +266,11 @@ TOML_NAMESPACE_START
(impl::value_variadic_ctor_allowed<value<ValueType>, impl::remove_cvref<Args>...>::value),
typename... Args)
TOML_NODISCARD_CTOR
- explicit value(Args&&... args) noexcept(noexcept(value_type(
- impl::native_value_maker<value_type, std::decay_t<Args>...>::make(static_cast<Args&&>(args)...))))
+ explicit value(Args&&... args)
+#if !TOML_DISABLE_NOEXCEPT_NOEXCEPT
+ noexcept(noexcept(value_type(
+ impl::native_value_maker<value_type, std::decay_t<Args>...>::make(static_cast<Args&&>(args)...))))
+#endif
: val_(impl::native_value_maker<value_type, std::decay_t<Args>...>::make(static_cast<Args&&>(args)...))
{
#if TOML_LIFETIME_HOOKS
diff --git a/toml.hpp b/toml.hpp
index 31e9ea84f4..ef3515b136 100644
--- a/toml.hpp
+++ b/toml.hpp
@@ -1137,6 +1137,16 @@ TOML_ENABLE_WARNINGS;
#define TOML_DISABLE_CONDITIONAL_NOEXCEPT_LAMBDA 0
#endif
+#ifndef TOML_DISABLE_NOEXCEPT_NOEXCEPT
+#define TOML_DISABLE_NOEXCEPT_NOEXCEPT 0
+ #ifdef _MSC_VER
+ #if _MSC_VER <= 1943 // Up to Visual Studio 2022 Version 17.13.6
+ #undef TOML_DISABLE_NOEXCEPT_NOEXCEPT
+ #define TOML_DISABLE_NOEXCEPT_NOEXCEPT 1
+ #endif
+ #endif
+#endif
+
#if !defined(TOML_FLOAT_CHARCONV) && (TOML_GCC || TOML_CLANG || (TOML_ICC && !TOML_ICC_CL))
// not supported by any version of GCC or Clang as of 26/11/2020
// not supported by any version of ICC on Linux as of 11/01/2021
@@ -5088,8 +5098,11 @@ TOML_NAMESPACE_START
(impl::value_variadic_ctor_allowed<value<ValueType>, impl::remove_cvref<Args>...>::value),
typename... Args)
TOML_NODISCARD_CTOR
- explicit value(Args&&... args) noexcept(noexcept(value_type(
- impl::native_value_maker<value_type, std::decay_t<Args>...>::make(static_cast<Args&&>(args)...))))
+ explicit value(Args&&... args)
+#if !TOML_DISABLE_NOEXCEPT_NOEXCEPT
+ noexcept(noexcept(value_type(
+ impl::native_value_maker<value_type, std::decay_t<Args>...>::make(static_cast<Args&&>(args)...))))
+#endif
: val_(impl::native_value_maker<value_type, std::decay_t<Args>...>::make(static_cast<Args&&>(args)...))
{
#if TOML_LIFETIME_HOOKS