[cfe-dev] parentheses flag warning

David Blaikie via cfe-dev cfe-dev at lists.llvm.org
Mon May 18 10:39:39 PDT 2020


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/85cc174b/attachment.html>


More information about the cfe-dev mailing list