https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64524
--- Comment #2 from David Binderman <dcb314 at hotmail dot com> --- (In reply to Jakub Jelinek from comment #1) > Should it complain only when the expressions are the same (e.g. token-wise), > or even when just two different expressions have the same value? > I mean, say: > enum X { E = 5, F = 5 }; > int i = cond ? E : F; > int j = cond ? x + 3 : x + 2 + 1; > int k = cond ? sizeof (x) : sizeof (y); > etc. All would be good ;-> I suspect token-wise comparison would be simple and cheap, so suggest do that first. That would cover my example. I suspect more complex would be making sure two compile time constants have the same value, so suggest do that second. That would cover cases i and k above. Suspect case j would be more difficult, since it involves expression comparison. Suggest leave till last. Feel free to adjust the priority order if my guesses are wrong.