Closed SimonKagstrom closed 10 months ago
Wow, what an interesting find! I'm afraid it may take a while to understand exactly where and how things go wrong here. This is not obvious to me at all.
I've worked around it by changing the interface to return a (slightly contrived) value in the expected case, so no worries!
Current clang/libc++ main has support for C++23 std::expected, and using that instead works, so I'm leaning towards this being a bug in tl::expected. I'll investigate more, though.
It also works with Martin Moene's expected-lite
. https://github.com/martinmoene/expected-lite/tree/master
Thanks!
Closing this since it's looks like a bug in tl::expected. We used expected-lite a while back, but for some reason I don't remember, we replaced it with tl::expected. Might be worth reconsidering again.
Environment (from conan):
I have a problem with mocking
tl::expected
return values, which has a void expected value (i.e., for a case where only the error value is interesting). I can't figure out how to write theREQUIRE_CALL
for the expected value, which in real code would just do areturn {}
.Example below. I've tried various other variants, but not found a working solution.
The error, after a long list of other complaints, boils down to