2010-09-08 02:43:57 +08:00
|
|
|
// RUN: not %llvmgcc_only -c %s -o /dev/null |& FileCheck %s
|
2007-10-02 05:22:57 +08:00
|
|
|
// PR 1603
|
2010-09-08 02:43:57 +08:00
|
|
|
void func()
|
2007-10-02 05:22:57 +08:00
|
|
|
{
|
|
|
|
const int *arr;
|
2010-09-08 04:39:07 +08:00
|
|
|
arr[0] = 1; // CHECK: error: assignment of read-only location
|
2007-10-02 05:22:57 +08:00
|
|
|
}
|
|
|
|
|
2010-09-08 02:43:57 +08:00
|
|
|
struct foo {
|
|
|
|
int bar;
|
|
|
|
};
|
|
|
|
struct foo sfoo = { 0 };
|
|
|
|
|
|
|
|
int func2()
|
|
|
|
{
|
|
|
|
const struct foo *fp;
|
|
|
|
fp = &sfoo;
|
|
|
|
fp[0].bar = 1; // CHECK: error: assignment of read-only member 'bar'
|
|
|
|
return sfoo.bar;
|
|
|
|
}
|