Skip to content

Commit

Permalink
Migrate 2007-10-01-BuildArrayRef.c from llvm/test/FrontendC.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135840 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
echristo committed Jul 23, 2011
1 parent 3db87b8 commit 52a75ba
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/Sema/2007-10-01-BuildArrayRef.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// RUN: not %clang_cc1_only -c %s -o - > /dev/null
// PR 1603
void func()
{
const int *arr;
arr[0] = 1; // expected-error {{assignment of read-only location}}
}

struct foo {
int bar;
};
struct foo sfoo = { 0 };

int func2()
{
const struct foo *fp;
fp = &sfoo;
fp[0].bar = 1; // expected-error {{ assignment of read-only member}}
return sfoo.bar;
}

0 comments on commit 52a75ba

Please sign in to comment.