Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMartin Hořeňovský2026-05-08 20:53:39 +0200
committerMartin Hořeňovský2026-05-09 22:24:12 +0200
commita18badd10fce6c3e087eef82699f371cf6f99fa7 (patch)
tree53ac73fd27cb65929f096acbbd03ce64ca76604f
parent54af40652aca0403298b8c2f7c76c8c851132199 (diff)
downloadcatch3-a18badd10fce6c3e087eef82699f371cf6f99fa7.tar.gz
Workaround P3168 causing ambiguous overload issues with StringMaker
P3168 turned `std::optional` into a range type, so the partial specialization of `StringMaker` for `std::optional<T>` conflicted with the partial specialization for range types. Ideally we will fix this in the future to support user-provided partial specializations for range-like types, but for now we just disable the partial specialization for `std::optional<T>` if P3168 is implemented.
-rw-r--r--src/catch2/catch_tostring.hpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/catch2/catch_tostring.hpp b/src/catch2/catch_tostring.hpp
index 16c4c496..e421b8b5 100644
--- a/src/catch2/catch_tostring.hpp
+++ b/src/catch2/catch_tostring.hpp
@@ -384,7 +384,10 @@ namespace Catch {
}
#endif // CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER
-#if defined(CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_OPTIONAL)
+#if defined( CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER ) && \
+ defined( CATCH_CONFIG_CPP17_OPTIONAL ) && \
+ /* P3168 turned optional into a range, making this ambigous with the range support */ \
+ !defined( __cpp_lib_optional_range_support )
#include <optional>
namespace Catch {
template<typename T>