2013-12-09 02:49:05 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
2011-07-23 10:16:25 +08:00
|
|
|
// PR 1603
|
|
|
|
void func()
|
|
|
|
{
|
|
|
|
const int *arr;
|
2013-12-09 02:49:05 +08:00
|
|
|
arr[0] = 1; // expected-error {{read-only variable is not assignable}}
|
2011-07-23 10:16:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
struct foo {
|
|
|
|
int bar;
|
|
|
|
};
|
|
|
|
struct foo sfoo = { 0 };
|
|
|
|
|
|
|
|
int func2()
|
|
|
|
{
|
|
|
|
const struct foo *fp;
|
|
|
|
fp = &sfoo;
|
2013-12-09 02:49:05 +08:00
|
|
|
fp[0].bar = 1; // expected-error {{read-only variable is not assignable}}
|
2011-07-23 10:16:25 +08:00
|
|
|
return sfoo.bar;
|
|
|
|
}
|