------- Comment #15 from redi at gcc dot gnu dot org 2010-06-26 13:46 ------- (In reply to comment #14) > > However, it links in the if-else case.
The variable is not "used" in the [basic.def.odr] sense, because the lvalue-to-rvalue conversion occurs immediately. > I understand that ?: may be used as a > lvalue, but in this case, it is not and the value may be inlined in the same > way as in if-else (I guess that is what Andrew's patch did). If the standard > is > clear that this should not work, then so be it. The lvalue-to-rvalue conversion doesn't happen immediately to either the second or third operand, it happens to the result of the conditional expression. Andrew's idea might be allowed by the as-if rule, but I'm not sure. It must not change the behaviour of valid programs. And in any case, the original example is invalid. Supporting it is not important IMHO. > Let's close this as INVALID, because I don't know how we could improve the > diagnostics here to help users. I wish we could but I cannot see how it can be > done. I guess that would require an integrated super-smart linker, I wonder if > the LLVM project is going to suggest that next? closing again -- redi at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44673