While playing with a refactoring hack, I noticed that locations in
lvalue errors are sometimes incorrect.
E.g., consider this file:
int q(int x)
{
(x + 0) = 5;
(x + 0)
= 7;
}
One error is reported against the '=', but the other is not:
opsy. gcc --syntax-only q.c
q.c: In function âqâ:
q.c:3:3: error: lvalue required as left operand of assignment
q.c:5:5: error: lvalue required as left operand of assignment
I think it makes sense to report the error using the '=' token.
That is what this patch does. The new output is:
opsy. gcc --syntax-only q.c
q.c: In function âqâ:
q.c:3:11: error: lvalue required as left operand of assignment
q.c:5:5: error: lvalue required as left operand of assignment