[cfe-dev] Spurious -Wunused-comparison

Richard Trieu rtrieu at google.com
Mon Jul 14 11:31:38 PDT 2014


Samuel,

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

Richard


On Sun, Jul 13, 2014 at 2:50 PM, Samuel Williams <
space.ship.traveller at gmail.com> wrote:

> 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
>>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140714/6f15441d/attachment.html>


More information about the cfe-dev mailing list