This is the mail archive of the
mailing list for the GCC project.
Re: PATCH RFA: C++: Omit incorrect "no effect" warnings
- From: Ian Lance Taylor <iant at google dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 25 Jun 2009 12:10:33 -0700
- Subject: Re: PATCH RFA: C++: Omit incorrect "no effect" warnings
- References: <email@example.com> <4A439F8B.firstname.lastname@example.org>
Jason Merrill <email@example.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.