2007-10-01-BuildArrayRef.c 369 B

1234567891011121314151617181920
  1. // RUN: %clang_cc1 -fsyntax-only -verify %s
  2. // PR 1603
  3. void func()
  4. {
  5. const int *arr;
  6. arr[0] = 1; // expected-error {{read-only variable is not assignable}}
  7. }
  8. struct foo {
  9. int bar;
  10. };
  11. struct foo sfoo = { 0 };
  12. int func2()
  13. {
  14. const struct foo *fp;
  15. fp = &sfoo;
  16. fp[0].bar = 1; // expected-error {{read-only variable is not assignable}}
  17. return sfoo.bar;
  18. }