blob: 2552934f64852d40af7e418a77376780de97981c [file] [log] [blame]
Alp Tokera6443142013-12-08 18:49:05 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Eric Christopher279c20f2011-07-23 02:16:25 +00002// PR 1603
3void func()
4{
5 const int *arr;
Alp Tokera6443142013-12-08 18:49:05 +00006 arr[0] = 1; // expected-error {{read-only variable is not assignable}}
Eric Christopher279c20f2011-07-23 02:16:25 +00007}
8
9struct foo {
10 int bar;
11};
12struct foo sfoo = { 0 };
13
14int func2()
15{
16 const struct foo *fp;
17 fp = &sfoo;
Alp Tokera6443142013-12-08 18:49:05 +000018 fp[0].bar = 1; // expected-error {{read-only variable is not assignable}}
Eric Christopher279c20f2011-07-23 02:16:25 +000019 return sfoo.bar;
20}