[cfe-dev] parentheses flag warning
Billy Araujo via cfe-dev
cfe-dev at lists.llvm.org
Mon May 18 10:44:32 PDT 2020
Hi David,
So I guess this is expected behaviour. Thanks.
Regards,
Billy.
On Mon, May 18, 2020 at 6:39 PM David Blaikie <dblaikie at gmail.com> wrote:
> GCC doesn't seem to warn on this either. On the basis of the original
> warning I could see how this case could merit similar handling - but I
> doubt we'd want to add that handling to the existing flag at this point
> (due to the number of people over the decades that have used the warning
> for the behavior it currently provides, not expecting the new/additional
> behavior for the ternary operator or other bool-testing assignment
> situations (eg: "void f(bool); f(x = 5);")
>
> On Mon, May 18, 2020 at 6:53 AM Billy Araujo via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>> -Wparentheses
>>
>> warns for line 3 but not for the ternary expression in line 2.
>>
>> 1 static void foo(int a, int b, int x) {
>> 2 x = (x = 10) ? a : b;
>> 3 if (x = 10) { x = a; } else { x = b; }
>> 4 }
>>
>> Is this a bug?
>>
>> Regards,
>>
>> Billy.
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200518/49526600/attachment.html>
More information about the cfe-dev
mailing list