------- Additional Comments From mark at codesourcery dot com 2005-03-25 06:29 ------- Subject: Re: [3.3/3.4/4.0/4.1 Regression] Wrong warning about returning a reference to a temporary
> Alex, could you confirm that the above suggestion resolves the PR when used > in combination with your maybe_lvalue_p split? Mark, do you agree that this > is a reasonable (the most reasonable?) compromise in the 4.0 timeframe? Thank you for looking at this again. Yes, I think your patch is a reasonable solution in the 4.0 timeframe. It does, of course, mean that there will be programs that are less well-optimized in C++ than in C, but I agree with you that there's no good way around that in the short term. If you're worried about the cost of the strcmp, you could cache the result, but I have no reason to think that's a real problem. Also, I think this patch should go on the mainline too, until we get a better fix -- but I think we should work on that, so that this doesn't actually make it into 4.1. (In 4.1, I disagree that we need new tree codes. I think all we need to do is wait to call fold until gimplification time in C++; then, the middle end will never see COND_EXPRs used as lvalues. In C++, conditionals can be lvalues, but we actually fix that up before passing them to the middle end. The middle end sees COND_EXPRs that would be lvalues in C++, but they are only used as rvalues, so the transformation in fold would be fine. But, we can have that debate later!) Thanks, -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19199