Commit 550707f7 by Richard Kenner

(readonly_warning): Correctly check for assignments to iterators.

From-SVN: r4193
parent 392202b0
...@@ -3446,11 +3446,10 @@ readonly_warning (arg, string) ...@@ -3446,11 +3446,10 @@ readonly_warning (arg, string)
strcpy (buf, string); strcpy (buf, string);
/* Forbid assignments to iterators. */ /* Forbid assignments to iterators. */
if (TREE_CODE (TREE_OPERAND (arg, 0)) == VAR_DECL if (TREE_CODE (arg) == VAR_DECL && ITERATOR_P (arg))
&& ITERATOR_P (TREE_OPERAND (arg, 0)))
{ {
strcat (buf, " of iterator `%s'"); strcat (buf, " of iterator `%s'");
pedwarn (buf, IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (arg, 1)))); pedwarn (buf, IDENTIFIER_POINTER (DECL_NAME (arg)));
} }
if (TREE_CODE (arg) == COMPONENT_REF) if (TREE_CODE (arg) == COMPONENT_REF)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment