Spurious -Wunused-comparison


I’m implementing

class Foo {
void operator==(…) {}

for a DSL and getting errors:

warning: equality comparison result unused [-Wunused-comparison]

I feel this error is not appropriate in such circumstances?

Kind regards,

Hi Samuel,

Hi Csaba, a good question,

it is for unit testing syntax similar to rspec, e.g.

expect(value).to_be == some_other_value

Internally, the comparison is done and if it isn't valid, the unit test is marked as failed. The same with other operators and function calls.

Kind regards,


Can you tell me what version of Clang you are using? I believed an exemption was added to void returning overloaded comparisons in r209186.


Is this sufficient?

3.4.2 doesn’t have that revision, give trunk a try or wait until 3.5 as it’s not too far away.

Nikola, I really appreciate your insight and knowledge. Thanks for your help and time.