boostorg / system

Boost.org system module
http://boost.org/libs/system
36 stars 85 forks source link

cond vs code comparison not visible from error_condition #91

Closed nUl1 closed 2 years ago

nUl1 commented 2 years ago

Hello,

Commit 9fdfa6c645f0d1f1060e1a0f93f456314f992107 moved comparison operators from namespace into error_code as a friend functions. This made them invisible to name lookup from error_condition when error_code does not participate directly in the comparison.

As a result, comparing an error_condition to a boost::system::error_code enumeration does not work anymore. At the same time comparison with std::error_code enumerations works because these operators are declared as error_condition friends (the same problem stands with std::error_code vs error_condition enum though).

Example: https://godbolt.org/z/5qbPesvnz

It looks like some forward declarations for comparison operators outside classes would allow for name lookup to work and will fix the issue, but I'm not sure where is the right place to put them.

pdimov commented 2 years ago

I agree that this is a regression, even though I can't think of a legitimate use case for comparing conditions against error code enums.