Skip to content

Commit a18badd

Browse files
committed
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.
1 parent 54af406 commit a18badd

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/catch2/catch_tostring.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,10 @@ namespace Catch {
384384
}
385385
#endif // CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER
386386

387-
#if defined(CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_OPTIONAL)
387+
#if defined( CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER ) && \
388+
defined( CATCH_CONFIG_CPP17_OPTIONAL ) && \
389+
/* P3168 turned optional into a range, making this ambigous with the range support */ \
390+
!defined( __cpp_lib_optional_range_support )
388391
#include <optional>
389392
namespace Catch {
390393
template<typename T>

0 commit comments

Comments
 (0)