This is the mail archive of the gcc-bugs@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]

[Bug c++/64524] gcc can't detect same expression in both parts of ternary operator


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64524

--- Comment #6 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to Andrew Pinski from comment #5)
> And really here is another false positive:
> #define a 1
> #define b 1
> 
> int t = c > d ? a : b;

Assuming you meant

int t = (c > d) ? a : b;

then I'd be interested to find out how that's a false positive.

Just to add some salt into the pot, another interesting case might be

enum E { a, b, c, d };

void f(int val)
{
    int n = (val >= 10) ? a : (d - 4);


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