Allow stdx::optional to be used in Catch comparison expressions

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Duplicate
    • Priority: Major - P3
    • 3.3.0-rc0
    • Affects Version/s: None
    • Component/s: Testing
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      If "a" and "b" are of type stdx::optional<T>, then the test assertion "REQUIRE(a == b);" may not compile under certain configurations.

      Specifically, on the driver's current Windows CI hosts (which use use Boost polyfills for stdx), these statements fail to compile with the following error:

      error C2338: If you want to output boost::optional, include header <boost/optional/optional_io.hpp>

      This is due to the fact that Catch attempts to convert comparison operands to strings with
      operator<<(), in case of an assertion failure.

      After pulling in optional_io.hpp, the following error is still generated for certain types, even types that Catch is normally perfectly happy to normally include in REQUIRE() comparison statements (like enum class types):

      error C2679: binary '<<': no operator found which takes a right-hand operand of type 'T' (or there is no acceptable conversion)

      We should come up with some sort of solution that makes it legal to compare objects of type stdx::optional<T> in test cases whenever it is legal to compare objects of type T.

              Assignee:
              A. Jesse Jiryu Davis
              Reporter:
              [DO NOT USE] Backlog - CXX Driver Team
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: