arocc
arocc copied to clipboard
Improve error for assigning to const
int foo(void) {
const int a;
a = 1;
return a;
}
Arocc output:
./a.c:40:7: error: expression is not assignable
a = 1;
^
1 error generated.
Clang output:
a.c:40:7: error: cannot assign to variable 'a' with const-qualified type 'const int'
a = 1;
~ ^
a.c:39:15: note: variable 'a' declared const here
const int a;
~~~~~~~~~~^
1 error generated.