On Wed, 3 Jun 2015, Marek Polacek wrote:

> Since a cast does not yield an lvalue, we shouldn't accept invalid
> code as in the attached testcase.
> 
> The problem was that we weren't setting NON_LVALUE_EXPR properly;
> for comparing expressions we shouldn't use ==, because then a cast
> in an expression might confuse us.

I'm not clear on what trees you get in the problem case (or which of the 
tests in the testcase you added was broken before - they don't seem that 
similar to the tests in the bug).  It would seem safer to me to use 
lvalue_p (value) as the condition for adding a NON_VALUE_EXPR.

> +  /* A cast to a qualified type has the same effect as a cast
> +     to the unqualified version of the type.  */
> +  (const int *) p = 0; /* { dg-error "lvalue required as left operand of 
> assignment" } */

That's not a cast to a qualified type.  A cast to qualified type would be 
(int *const) p.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to