
2018-02-06 1:00 GMT+01:00 Rob Stewart via Boost
On February 5, 2018 3:43:49 AM EST, Andrzej Krzemienski via Boost < boost@lists.boost.org> wrote:
Let me expand on this a bit. I have the following program where I save the result, but not inspect it:
``` #include "outcome.hpp" namespace out = OUTCOME_V2_NAMESPACE;
out::result<void> fun() { return out::success(); }
int main() { auto r = fun(); } ```
When I compile with clang, with -Wall -Wextra -Werror, I get an error saying, "unused variable 'r'". See online examle: https://wandbox.org/permlink/WE7dK6r5XCIxJ83f
When I compile with GCC, I do not get this warning. But in my work, w compile programs with GCC, but still use clang for the static analysis pass, and nonetheless this bug would be detected.
IOW, one must use certain tools and options to get the protection.
I think the library could, at least, assert in debug builds when a result or outcome is not inspected.
Yes, that sounds like a useful addition. Regards, &rzej;