blob: 4692731b5c2595398069cc0b61ef70f5361c42cf [file] [log] [blame]
Eric Christopher52a75ba2011-07-23 02:16:25 +00001// RUN: not %clang_cc1_only -c %s -o - > /dev/null
2// PR 1603
3void func()
4{
5 const int *arr;
6 arr[0] = 1; // expected-error {{assignment of read-only location}}
7}
8
9struct 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; // expected-error {{ assignment of read-only member}}
19 return sfoo.bar;
20}