ned14 / outcome

Provides very lightweight outcome<T> and result<T> (non-Boost edition)
https://ned14.github.io/outcome
Other
676 stars 62 forks source link

BOOST_OUTCOME_NODISCARD preprocessor logic is flawed #208

Closed hazelnusse closed 4 years ago

hazelnusse commented 4 years ago

If __has_cpp_attribute is defined but __has_cpp_attribute(nodiscard) is false, BOOST_OUTCOME_NODISCARD will end up as defined but empty because the __clang__ and _MSC_VER branches will be skipped. In addition, the __clang__ branch should really be __clang__ or __GNUC__ since both of these support the __attribute__(warn_unused_result).

Proposed fix is implemented in #207

ned14 commented 4 years ago

I vaguely remember that this is already fixed in the feature branch, but I suspect maybe not as completely as yours. Thanks for the BR and PR #207 !

hazelnusse commented 4 years ago

No problem @ned14, happy to help.

hazelnusse commented 4 years ago

It looks like the feature_branch branch has the same logic with respect to BOOST_OUTCOME_NODISCARD: https://github.com/ned14/outcome/blob/feature_branch/boostify/include/boost/outcome/config.hpp#L54

Maybe you had a different branch in mind?

ned14 commented 4 years ago

Fixed! Thanks for the BR!