blob: c5d1c97d877e675d4754747ca9e8a92e3ccdfdae (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
/* { dg-do compile } */
/* { dg-options "-O" } */
int func()
{
const int *arr;
const int arr2[5];
arr[0] = 1; /* { dg-error "assignment of read-only location" "*(arr)" } */
arr[1] = 1; /* { dg-error "assignment of read-only location" "*(arr + 4u)" } */
arr2[0] = 1; /* { dg-error "assignment of read-only location" "arr2\[0\]" } */
arr2[1] = 1; /* { dg-error "assignment of read-only location" "arr2\[1\]" } */
}
|