blob: 092bc4204d7905aa9a15936c435e54756f87854f [file] [log] [blame]
Stuart Hastingsaf58e8d2010-09-07 18:43:57 +00001// RUN: not %llvmgcc_only -c %s -o /dev/null |& FileCheck %s
Devang Patel44247572007-10-01 21:22:57 +00002// PR 1603
Stuart Hastingsaf58e8d2010-09-07 18:43:57 +00003void func()
Devang Patel44247572007-10-01 21:22:57 +00004{
5 const int *arr;
Stuart Hastingsaf58e8d2010-09-07 18:43:57 +00006 arr[0] = 1; // CXHECK: error: assignment of read-only location
Devang Patel44247572007-10-01 21:22:57 +00007}
8
Stuart Hastingsaf58e8d2010-09-07 18:43:57 +00009struct foo {
10 int bar;
11};
12struct foo sfoo = { 0 };
13
14int func2()
15{
16 const struct foo *fp;
17 fp = &sfoo;
18 fp[0].bar = 1; // CHECK: error: assignment of read-only member 'bar'
19 return sfoo.bar;
20}