[cfe-dev] Spurious -Wunused-comparison
Samuel Williams
space.ship.traveller at gmail.com
Sun Jul 13 14:50:55 PDT 2014
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,
Samuel
On 14/07/14 03:35, Csaba Raduly wrote:
> Hi Samuel,
>
> On Sat, Jul 12, 2014 at 7:34 AM, Samuel Williams wrote:
>> Hi.
>>
>> 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?
> What's the point of implementing operator== (equality comparison!) if
> you can't get the result?
>
> The return type of operator== should be bool.
>
> Csaba
More information about the cfe-dev
mailing list