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

Re: [PATCH] Fix PR C++/28989, post-increment of bool is wrongly considered a lvalue


Andrew Pinski wrote:

cp/ChangeLog:
	* tree.c (lvalue_p_1 <case SAVE_EXPR>): SAVE_EXPRs are never
	lvalues.

Are you sure this is safe? What about something like "++i", which is an lvalue, but has side-effects, and might therefore be turned into a SAVE_EXPR at some point? For example, in "new S[++i]", we might make a SAVE_EXPR for "++i" before we call "operator new[]", but then need the value later. In this case, I don't think lvalueness would matter, though, so maybe we are still OK.


I like the idea of this patch, but I'm nervous that a case like this would confuse us. Please attach your patch to the PR, and add any thoughts you might have about these sorts of corner cases.

Thanks,

--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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