[cfe-commits] r135840 - /cfe/trunk/test/Sema/2007-10-01-BuildArrayRef.c

Eric Christopher echristo at apple.com
Fri Jul 22 19:16:25 PDT 2011


Author: echristo
Date: Fri Jul 22 21:16:25 2011
New Revision: 135840

URL: http://llvm.org/viewvc/llvm-project?rev=135840&view=rev
Log:
Migrate 2007-10-01-BuildArrayRef.c from llvm/test/FrontendC.

Added:
    cfe/trunk/test/Sema/2007-10-01-BuildArrayRef.c

Added: cfe/trunk/test/Sema/2007-10-01-BuildArrayRef.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/2007-10-01-BuildArrayRef.c?rev=135840&view=auto
==============================================================================
--- cfe/trunk/test/Sema/2007-10-01-BuildArrayRef.c (added)
+++ cfe/trunk/test/Sema/2007-10-01-BuildArrayRef.c Fri Jul 22 21:16:25 2011
@@ -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;
+}





More information about the cfe-commits mailing list