This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH RFA: C++: Omit incorrect "no effect" warnings


Jason Merrill <jason@redhat.com> writes:

> On 06/17/2009 01:25 PM, Ian Lance Taylor wrote:
>> In the C++ frontend, code like this:
>>
>>    b ? f1(), 0 : 0;
>>
>> gets a warning "right-hand operand of comma has no effect".  As
>> described in
>
> You mean "third operand of conditional"?

No, I really do mean "right-hand operand of comma".  There is no warning
about the third operand of the conditional, because the second operand
has a side effect.  Then the code steps into the second operand.  At
that point it is looking at a comma operator which it is casting to
void.  It then proceeds to warn about the right hand side of the comma
operator.  This warning is wrong because the comma operator is only
there because it is in a conditional.


> The patch is OK.

Thanks.  Committed.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]